mirror of
https://github.com/XRPLF/rippled.git
synced 2026-04-29 15:37:57 +00:00
updates websocketpp::exception to wrap lib::error_code
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user