28 #ifndef WEBSOCKETPP_ERROR_HPP
29 #define WEBSOCKETPP_ERROR_HPP
35 #include <websocketpp/common/cpp11.hpp>
36 #include <websocketpp/common/system_error.hpp>
151 char const * name()
const _WEBSOCKETPP_NOEXCEPT_TOKEN_ {
152 return "websocketpp";
155 std::string message(
int value)
const {
158 return "Generic error";
160 return "send queue full";
162 return "payload violation";
164 return "endpoint not secure";
166 return "endpoint not available";
168 return "invalid uri";
170 return "no outgoing message buffers";
172 return "no incoming message buffers";
174 return "invalid state";
176 return "Unable to extract close code";
178 return "Extracted close code is in an invalid range";
180 return "Extracted close code is in a reserved range";
182 return "Invalid UTF-8";
184 return "Invalid subprotocol";
186 return "Bad Connection";
190 return "Connection creation attempt failed";
192 return "Selected subprotocol was not requested by the client";
194 return "Feature not available on server endpoints";
196 return "Feature not available on client endpoints";
198 return "HTTP connection ended";
200 return "The opening handshake timed out";
202 return "The closing handshake timed out";
204 return "Invalid URI port";
206 return "Async Accept not listening";
208 return "Operation canceled";
210 return "Connection rejected";
212 return "Upgrade required";
214 return "Invalid version";
216 return "Unsupported version";
218 return "HTTP parse error";
225 inline const lib::error_category& get_category() {
230 inline lib::error_code make_error_code(
error::value e) {
231 return lib::error_code(static_cast<int>(e), get_category());
237 _WEBSOCKETPP_ERROR_CODE_ENUM_NS_START_
240 static bool const value =
true;
242 _WEBSOCKETPP_ERROR_CODE_ENUM_NS_END_
249 : m_msg(msg.empty() ? ec.message() : msg), m_code(ec)
258 virtual char const * what()
const throw() {
259 return m_msg.c_str();
262 lib::error_code code()
const throw() {
267 lib::error_code m_code;
272 #endif // WEBSOCKETPP_ERROR_HPP
uint16_t value
The type of a close code value.
Attempted to use a client specific feature on a server endpoint.
std::pair< lib::error_code, std::string > err_str_pair
Combination error code / string type for returning two values.
Selected subprotocol was not requested by the client.
Unable to parse close code.
Close code is in a reserved range.
Invalid WebSocket protocol version.
The connection was in the wrong state for this operation.
Namespace for the WebSocket++ project.
The requested operation was canceled.
The endpoint is out of incoming message buffers.
send attempted when endpoint write queue was full
The endpoint is out of outgoing message buffers.
WebSocket close handshake timed out.
WebSocket opening handshake timed out.
Attempted to use a server specific feature on a client endpoint.
Attempted to open a secure connection with an insecure endpoint.
Unit testing utility error code.
An invalid uri was supplied.
Unsupported WebSocket protocol version.
Connection creation attempted failed.