This commit is contained in:
Peter Thorson
2013-05-03 08:32:59 -05:00
parent 87da82698f
commit 05fb9aadb1

View File

@@ -50,59 +50,59 @@ namespace socket {
*/
namespace error {
enum value {
/// Catch-all error for security policy errors that don't fit in other
/// categories
security = 1,
enum value {
/// Catch-all error for security policy errors that don't fit in other
/// categories
security = 1,
/// Catch-all error for socket component errors that don't fit in other
/// categories
socket,
/// A function was called in a state that it was illegal to do so.
invalid_state,
/// The application was prompted to provide a TLS context and it was
/// empty or otherwise invalid
invalid_tls_context,
/// TLS Handshake Timeout
tls_handshake_timeout,
/// pass_through from underlying library
pass_through,
/// A function was called in a state that it was illegal to do so.
invalid_state,
/// The application was prompted to provide a TLS context and it was
/// empty or otherwise invalid
invalid_tls_context,
/// TLS Handshake Timeout
tls_handshake_timeout,
/// pass_through from underlying library
pass_through,
/// Required tls_init handler not present
missing_tls_init_handler
};
};
} // namespace error
class socket_category : public lib::error_category {
public:
const char *name() const _WEBSOCKETPP_NOEXCEPT_TOKEN_ {
return "websocketpp.transport.asio.socket";
}
std::string message(int value) const {
switch(value) {
case error::security:
return "Security policy error";
case error::socket:
return "Socket component error";
case error::invalid_state:
return "Invalid state";
case error::invalid_tls_context:
return "Invalid or empty TLS context supplied";
case error::tls_handshake_timeout:
return "TLS handshake timed out";
case error::pass_through:
return "Pass through from underlying library";
const char *name() const _WEBSOCKETPP_NOEXCEPT_TOKEN_ {
return "websocketpp.transport.asio.socket";
}
std::string message(int value) const {
switch(value) {
case error::security:
return "Security policy error";
case error::socket:
return "Socket component error";
case error::invalid_state:
return "Invalid state";
case error::invalid_tls_context:
return "Invalid or empty TLS context supplied";
case error::tls_handshake_timeout:
return "TLS handshake timed out";
case error::pass_through:
return "Pass through from underlying library";
case error::missing_tls_init_handler:
return "Required tls_init handler not present.";
default:
return "Unknown";
}
}
return "Required tls_init handler not present.";
default:
return "Unknown";
}
}
};
inline const lib::error_category& get_socket_category() {
@@ -111,7 +111,7 @@ inline const lib::error_category& get_socket_category() {
}
inline lib::error_code make_error(error::value e) {
return lib::error_code(static_cast<int>(e), get_socket_category());
return lib::error_code(static_cast<int>(e), get_socket_category());
}
typedef lib::function<void(const lib::error_code&)> init_handler;