28 #ifndef WEBSOCKETPP_ERROR_HPP 29 #define WEBSOCKETPP_ERROR_HPP 35 #include <websocketpp/common/cpp11.hpp> 36 #include <websocketpp/common/system_error.hpp> 150 class category :
public lib::error_category {
154 char const * name()
const _WEBSOCKETPP_NOEXCEPT_TOKEN_ {
155 return "websocketpp";
158 std::string message(
int value)
const {
161 return "Generic error";
162 case error::send_queue_full:
163 return "send queue full";
164 case error::payload_violation:
165 return "payload violation";
166 case error::endpoint_not_secure:
167 return "endpoint not secure";
168 case error::endpoint_unavailable:
169 return "endpoint not available";
170 case error::invalid_uri:
171 return "invalid uri";
172 case error::no_outgoing_buffers:
173 return "no outgoing message buffers";
174 case error::no_incoming_buffers:
175 return "no incoming message buffers";
176 case error::invalid_state:
177 return "invalid state";
178 case error::bad_close_code:
179 return "Unable to extract close code";
180 case error::invalid_close_code:
181 return "Extracted close code is in an invalid range";
182 case error::reserved_close_code:
183 return "Extracted close code is in a reserved range";
184 case error::invalid_utf8:
185 return "Invalid UTF-8";
186 case error::invalid_subprotocol:
187 return "Invalid subprotocol";
188 case error::bad_connection:
189 return "Bad Connection";
192 case error::con_creation_failed:
193 return "Connection creation attempt failed";
194 case error::unrequested_subprotocol:
195 return "Selected subprotocol was not requested by the client";
196 case error::client_only:
197 return "Feature not available on server endpoints";
198 case error::server_only:
199 return "Feature not available on client endpoints";
200 case error::http_connection_ended:
201 return "HTTP connection ended";
202 case error::open_handshake_timeout:
203 return "The opening handshake timed out";
204 case error::close_handshake_timeout:
205 return "The closing handshake timed out";
206 case error::invalid_port:
207 return "Invalid URI port";
208 case error::async_accept_not_listening:
209 return "Async Accept not listening";
210 case error::operation_canceled:
211 return "Operation canceled";
212 case error::rejected:
213 return "Connection rejected";
214 case error::upgrade_required:
215 return "Upgrade required";
216 case error::invalid_version:
217 return "Invalid version";
218 case error::unsupported_version:
219 return "Unsupported version";
220 case error::http_parse_error:
221 return "HTTP parse error";
222 case error::extension_neg_failed:
223 return "Extension negotiation failed";
230 inline const lib::error_category& get_category() {
231 static category instance;
235 inline lib::error_code make_error_code(error::value e) {
236 return lib::error_code(
static_cast<
int>(e), get_category());
242 _WEBSOCKETPP_ERROR_CODE_ENUM_NS_START_
243 template<>
struct is_error_code_enum<websocketpp::error::value>
245 static bool const value =
true;
247 _WEBSOCKETPP_ERROR_CODE_ENUM_NS_END_
253 exception(std::string
const & msg, lib::error_code ec = make_error_code(
error::general))
254 : m_msg(msg.empty() ? ec.message() : msg), m_code(ec)
257 explicit exception(lib::error_code ec)
258 : m_msg(ec.message()), m_code(ec)
261 ~exception()
throw() {}
263 virtual char const * what()
const throw() {
264 return m_msg.c_str();
267 lib::error_code code()
const throw() {
271 const std::string m_msg;
272 lib::error_code m_code;
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.
lib::weak_ptr< void > connection_hdl
A handle to uniquely identify a connection.
Unable to parse close code.
Library level error codes.
Close code is in a reserved range.
Invalid WebSocket protocol version.
The connection was in the wrong state for this operation.
The requested operation was canceled.
Extension negotiation failed.
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.