Remove catching websocketpp::lib::error_code in examples, fixes #584

A few versions ago the library was standardized to only throw
websocketpp::exception. Not all example code was updated.
This commit is contained in:
Peter Thorson
2016-10-03 19:04:12 -05:00
parent 8434139b67
commit e65b277017
9 changed files with 36 additions and 33 deletions
+5 -5
View File
@@ -128,9 +128,9 @@ void on_message(server* s, websocketpp::connection_hdl hdl, message_ptr msg) {
try {
s->send(hdl, msg->get_payload(), msg->get_opcode());
} catch (const websocketpp::lib::error_code& e) {
std::cout << "Echo failed because: " << e
<< "(" << e.message() << ")" << std::endl;
} catch (websocketpp::exception const & e) {
std::cout << "Echo failed because: "
<< "(" << e.what() << ")" << std::endl;
}
}
@@ -164,10 +164,10 @@ int main() {
// Start the ASIO io_service run loop
echo_server.run();
} catch (websocketpp::exception const & e) {
std::cout << e.what() << std::endl;
} catch (const std::exception & e) {
std::cout << e.what() << std::endl;
} catch (websocketpp::lib::error_code e) {
std::cout << e.message() << std::endl;
} catch (...) {
std::cout << "other exception" << std::endl;
}