2 * Copyright 2017 Facebook, Inc.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
24 class FutureException : public std::logic_error {
26 using std::logic_error::logic_error;
29 class BrokenPromise : public FutureException {
31 explicit BrokenPromise(const std::string& type)
32 : FutureException("Broken promise for type name `" + type + '`') {}
34 explicit BrokenPromise(const char* type) : BrokenPromise(std::string(type)) {}
37 class NoState : public FutureException {
39 NoState() : FutureException("No state") {}
42 class PromiseAlreadySatisfied : public FutureException {
44 PromiseAlreadySatisfied() : FutureException("Promise already satisfied") {}
47 class FutureNotReady : public FutureException {
49 FutureNotReady() : FutureException("Future not ready") {}
52 class FutureAlreadyRetrieved : public FutureException {
54 FutureAlreadyRetrieved() : FutureException("Future already retrieved") {}
57 class FutureCancellation : public FutureException {
59 FutureCancellation() : FutureException("Future was cancelled") {}
62 class TimedOut : public FutureException {
64 TimedOut() : FutureException("Timed out") {}
67 class PredicateDoesNotObtain : public FutureException {
69 PredicateDoesNotObtain() : FutureException("Predicate does not obtain") {}