2 * Copyright 2014 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.
21 namespace folly { namespace wangle {
23 class WangleException : public std::exception {
27 explicit WangleException(std::string message_arg)
28 : message(message_arg) {}
30 ~WangleException() throw(){}
32 virtual const char *what() const throw() {
33 return message.c_str();
36 bool operator==(const WangleException &other) const{
37 return other.message == this->message;
40 bool operator!=(const WangleException &other) const{
41 return !(*this == other);
48 class BrokenPromise : public WangleException {
50 explicit BrokenPromise() :
51 WangleException("Broken promise") { }
54 class NoState : public WangleException {
56 explicit NoState() : WangleException("No state") { }
59 class PromiseAlreadySatisfied : public WangleException {
61 explicit PromiseAlreadySatisfied() :
62 WangleException("Promise already satisfied") { }
65 class FutureAlreadyRetrieved : public WangleException {
67 explicit FutureAlreadyRetrieved () :
68 WangleException("Future already retrieved") { }
71 class UsingUninitializedTry : public WangleException {
73 explicit UsingUninitializedTry() :
74 WangleException("Using unitialized try") { }