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 [[noreturn]] void throwNoState();
44 class PromiseAlreadySatisfied : public FutureException {
46 PromiseAlreadySatisfied() : FutureException("Promise already satisfied") {}
49 [[noreturn]] void throwPromiseAlreadySatisfied();
51 class FutureNotReady : public FutureException {
53 FutureNotReady() : FutureException("Future not ready") {}
56 [[noreturn]] void throwFutureNotReady();
58 class FutureAlreadyRetrieved : public FutureException {
60 FutureAlreadyRetrieved() : FutureException("Future already retrieved") {}
63 [[noreturn]] void throwFutureAlreadyRetrieved();
65 class FutureCancellation : public FutureException {
67 FutureCancellation() : FutureException("Future was cancelled") {}
70 class TimedOut : public FutureException {
72 TimedOut() : FutureException("Timed out") {}
75 [[noreturn]] void throwTimedOut();
77 class PredicateDoesNotObtain : public FutureException {
79 PredicateDoesNotObtain() : FutureException("Predicate does not obtain") {}
82 [[noreturn]] void throwPredicateDoesNotObtain();
84 struct NoFutureInSplitter : FutureException {
85 NoFutureInSplitter() : FutureException("No Future in this FutureSplitter") {}
88 [[noreturn]] void throwNoFutureInSplitter();