Changed boost error handling (#74)

This commit is contained in:
Ravidu Lashan
2019-12-19 19:50:18 +05:30
committed by GitHub
parent 7255dae84c
commit 1972085b33
3 changed files with 2 additions and 13 deletions

View File

@@ -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*/)
{

View File

@@ -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.

View File

@@ -229,7 +229,7 @@ void socket_session<T>::send(const T msg)
try
{
std::lock_guard<std::mutex> 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 <class T>
void socket_session<T>::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")