proxygen
AsyncSocketException.h
Go to the documentation of this file.
1 /*
2  * Copyright 2014-present Facebook, Inc.
3  *
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
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  */
16 #pragma once
17 
18 #include <stdexcept>
19 #include <string>
20 
21 #include <folly/CPortability.h>
22 #include <folly/Range.h>
23 
24 namespace folly {
25 
26 class FOLLY_EXPORT AsyncSocketException : public std::runtime_error {
27  public:
29  UNKNOWN = 0,
30  NOT_OPEN = 1,
31  ALREADY_OPEN = 2,
32  TIMED_OUT = 3,
33  END_OF_FILE = 4,
35  BAD_ARGS = 6,
36  CORRUPTED_DATA = 7,
37  INTERNAL_ERROR = 8,
38  NOT_SUPPORTED = 9,
39  INVALID_STATE = 10,
40  SSL_ERROR = 12,
41  COULD_NOT_BIND = 13,
42  SASL_HANDSHAKE_TIMEOUT = 14,
44  EARLY_DATA_REJECTED = 16,
45  };
46 
49  const std::string& message,
50  int errnoCopy = 0)
51  : std::runtime_error(getMessage(type, message, errnoCopy)),
52  type_(type),
53  errno_(errnoCopy) {}
54 
56  return type_;
57  }
58 
60  return errno_;
61  }
62 
63  protected:
65  static folly::StringPiece getExceptionTypeString(
67 
69  static std::string getMessage(
71  const std::string& message,
72  int errnoCopy);
73 
76 
78  int errno_;
79 };
80 
81 } // namespace folly
Definition: test.c:42
PskType type
STL namespace.
—— Concurrent Priority Queue Implementation ——
Definition: AtomicBitSet.h:29
#define FOLLY_EXPORT
Definition: CPortability.h:133
requires E e noexcept(noexcept(s.error(std::move(e))))
AsyncSocketExceptionType type_
Type type_
Definition: JSONSchema.cpp:208
const char * string
Definition: Conv.cpp:212
const
Definition: upload.py:398
AsyncSocketException(AsyncSocketExceptionType type, const std::string &message, int errnoCopy=0)
AsyncSocketExceptionType getType() const noexcept