diff --git a/websocketpp/endpoint.hpp b/websocketpp/endpoint.hpp index c5af1e0d5b..cb52057f8f 100644 --- a/websocketpp/endpoint.hpp +++ b/websocketpp/endpoint.hpp @@ -284,7 +284,7 @@ public: void close(connection_hdl hdl, const close::status::value code, const std::string & reason); - /// Retrieves a connection_ptr from a connection_hdl + /// Retrieves a connection_ptr from a connection_hdl (exception free) /** * Converting a weak pointer to shared_ptr is not thread safe because the * pointer could be deleted at any time. @@ -307,6 +307,16 @@ public: } return con; } + + /// Retrieves a connection_ptr from a connection_hdl (exception version) + connection_ptr get_con_from_hdl(connection_hdl hdl) { + lib::error_code ec; + connection_ptr con = this->get_con_from_hdl(hdl,ec); + if (ec) { + throw ec; + } + return con; + } protected: