proxygen
Main Page
Related Pages
Namespaces
Classes
Files
Examples
File List
File Members
AsyncSocketException.cpp
Go to the documentation of this file.
1
/*
2
* Copyright 2017-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
17
#include <
folly/io/async/AsyncSocketException.h
>
18
19
#include <
folly/Format.h
>
20
#include <
folly/String.h
>
21
22
namespace
folly
{
23
24
/* static */
StringPiece
AsyncSocketException::getExceptionTypeString
(
25
AsyncSocketExceptionType
type
) {
26
switch
(type) {
27
case
UNKNOWN
:
28
return
"Unknown async socket exception"
;
29
case
NOT_OPEN
:
30
return
"Socket not open"
;
31
case
ALREADY_OPEN
:
32
return
"Socket already open"
;
33
case
TIMED_OUT
:
34
return
"Timed out"
;
35
case
END_OF_FILE
:
36
return
"End of file"
;
37
case
INTERRUPTED
:
38
return
"Interrupted"
;
39
case
BAD_ARGS
:
40
return
"Invalid arguments"
;
41
case
CORRUPTED_DATA
:
42
return
"Corrupted Data"
;
43
case
INTERNAL_ERROR
:
44
return
"Internal error"
;
45
case
NOT_SUPPORTED
:
46
return
"Not supported"
;
47
case
INVALID_STATE
:
48
return
"Invalid state"
;
49
case
SSL_ERROR
:
50
return
"SSL error"
;
51
case
COULD_NOT_BIND
:
52
return
"Could not bind"
;
53
case
SASL_HANDSHAKE_TIMEOUT
:
54
return
"SASL handshake timeout"
;
55
case
NETWORK_ERROR
:
56
return
"Network error"
;
57
case
EARLY_DATA_REJECTED
:
58
return
"Early data rejected"
;
59
default
:
60
return
"(Invalid exception type)"
;
61
}
62
}
63
64
/* static */
std::string
AsyncSocketException::getMessage
(
65
AsyncSocketExceptionType
type
,
66
const
std::string
&
message
,
67
int
errnoCopy) {
68
if
(errnoCopy != 0) {
69
return
sformat
(
70
"AsyncSocketException: {}, type = {}, errno = {} ({})"
,
71
message,
72
getExceptionTypeString
(type),
73
errnoCopy,
74
errnoStr
(errnoCopy));
75
}
else
{
76
return
sformat
(
77
"AsyncSocketException: {}, type = {}"
,
78
message,
79
getExceptionTypeString
(type));
80
}
81
}
82
83
}
// namespace folly
message
Definition:
test.c:42
folly::AsyncSocketException::INTERNAL_ERROR
Definition:
AsyncSocketException.h:37
folly::AsyncSocketException::CORRUPTED_DATA
Definition:
AsyncSocketException.h:36
folly::sformat
std::string sformat(StringPiece fmt, Args &&...args)
Definition:
Format.h:280
AsyncSocketException.h
type
PskType type
Definition:
ClientProtocol.cpp:777
folly::AsyncSocketException::INVALID_STATE
Definition:
AsyncSocketException.h:39
folly::AsyncSocketException::TIMED_OUT
Definition:
AsyncSocketException.h:32
folly::AsyncSocketException::SSL_ERROR
Definition:
AsyncSocketException.h:40
folly::AsyncSocketException::NOT_OPEN
Definition:
AsyncSocketException.h:30
folly
—— Concurrent Priority Queue Implementation ——
Definition:
AtomicBitSet.h:29
folly::AsyncSocketException::END_OF_FILE
Definition:
AsyncSocketException.h:33
folly::AsyncSocketException::COULD_NOT_BIND
Definition:
AsyncSocketException.h:41
folly::AsyncSocketException::UNKNOWN
Definition:
AsyncSocketException.h:29
folly::AsyncSocketException::AsyncSocketExceptionType
AsyncSocketExceptionType
Definition:
AsyncSocketException.h:28
folly::AsyncSocketException::getMessage
static std::string getMessage(AsyncSocketExceptionType type, const std::string &message, int errnoCopy)
Definition:
AsyncSocketException.cpp:64
folly::AsyncSocketException::getExceptionTypeString
static folly::StringPiece getExceptionTypeString(AsyncSocketExceptionType type)
Definition:
AsyncSocketException.cpp:24
folly::AsyncSocketException::NOT_SUPPORTED
Definition:
AsyncSocketException.h:38
folly::AsyncSocketException::ALREADY_OPEN
Definition:
AsyncSocketException.h:31
folly::AsyncSocketException::SASL_HANDSHAKE_TIMEOUT
Definition:
AsyncSocketException.h:42
Format.h
folly::Range< const char * >
folly::errnoStr
fbstring errnoStr(int err)
Definition:
String.cpp:463
folly::AsyncSocketException::BAD_ARGS
Definition:
AsyncSocketException.h:35
string
const char * string
Definition:
Conv.cpp:212
folly::AsyncSocketException::EARLY_DATA_REJECTED
Definition:
AsyncSocketException.h:44
folly::AsyncSocketException::NETWORK_ERROR
Definition:
AsyncSocketException.h:43
folly::AsyncSocketException::INTERRUPTED
Definition:
AsyncSocketException.h:34
String.h
proxygen
folly
folly
io
async
AsyncSocketException.cpp
Generated by
1.8.11