From 1972085b3390041804f3d446eeffc6cb105e15dc Mon Sep 17 00:00:00 2001 From: Ravidu Lashan Date: Thu, 19 Dec 2019 19:50:18 +0530 Subject: [PATCH] Changed boost error handling (#74) --- src/main.cpp | 9 --------- src/pchheader.hpp | 2 -- src/sock/socket_session.cpp | 4 ++-- 3 files changed, 2 insertions(+), 13 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index f4970b91..56c97b3a 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -77,15 +77,6 @@ void signal_handler(int signum) namespace boost { -/** - * Global exception handler for boost exceptions. - */ -void throw_exception(std::exception const &e) -{ - LOG_ERR << "Boost error: " << e.what() << "\n" - << boost::stacktrace::stacktrace(); - exit(1); -} inline void assertion_failed_msg(char const *expr, char const *msg, char const *function, char const * /*file*/, long /*line*/) { diff --git a/src/pchheader.hpp b/src/pchheader.hpp index 83bc627e..ec4e2a8d 100644 --- a/src/pchheader.hpp +++ b/src/pchheader.hpp @@ -1,8 +1,6 @@ #ifndef _HP_PCHHEADER_ #define _HP_PCHHEADER_ -// This will direct all boost exceptions to our error handler. -#define BOOST_NO_EXCEPTIONS // Enable boost strack trace. #define BOOST_STACKTRACE_USE_BACKTRACE // Enable custom handlers for boost assertion failures. diff --git a/src/sock/socket_session.cpp b/src/sock/socket_session.cpp index 68bde4f2..5a85441a 100644 --- a/src/sock/socket_session.cpp +++ b/src/sock/socket_session.cpp @@ -229,7 +229,7 @@ void socket_session::send(const T msg) try { std::lock_guard lock(send_mutex); - + // Always add to queue queue.push_back(std::move(msg)); //using sync write until async_write is properly handled for multi-threaded writes. @@ -316,7 +316,7 @@ template void socket_session::handle_exception(std::string_view event_name) { std::exception_ptr p = std::current_exception(); - LOG_ERR << "Socket Exception on " << event_name << ": " << (p ? p.__cxa_exception_type()->name() : "null") << std::endl; + LOG_ERR << "Socket Exception on " << event_name << ": " << (p ? p.__cxa_exception_type()->name() : "null") << " :"<< boost::stacktrace::stacktrace()<< std::endl; // Close the socket on any event error except close event. if (event_name != "close")