updates websocketpp::exception to wrap lib::error_code

This commit is contained in:
Peter Thorson
2014-03-05 08:30:08 -06:00
parent 9d8eced9a1
commit 770b32275c

View File

@@ -216,21 +216,30 @@ namespace websocketpp {
class exception : public std::exception {
public:
exception(std::string const & msg, error::value p_code = error::general)
: m_msg(msg), m_code(p_code) {}
exception(std::string const & msg, lib::error_code ec = make_error_code(error::general))
: m_msg(msg), m_code(ec)
{}
explicit exception(lib::error_code ec)
: m_code(ec)
{}
~exception() throw() {}
virtual char const * what() const throw() {
return m_msg.c_str();
if (m_msg.empty()) {
return m_code.message().c_str();
} else {
return m_msg.c_str();
}
}
error::value code() const throw() {
lib::error_code code() const throw() {
return m_code;
}
std::string m_msg;
error::value m_code;
lib::error_code m_code;
};
} // namespace websocketpp