Log common exceptions before asserting (#1278)
This commit is contained in:
parent
7578b816cb
commit
f7480aad6e
2 changed files with 18 additions and 0 deletions
|
@ -6,6 +6,8 @@
|
|||
#include <boost/property_tree/ptree.hpp>
|
||||
#include <cstdint>
|
||||
|
||||
#define FATAL_LOG_PREFIX "FATAL ERROR: "
|
||||
|
||||
namespace rai
|
||||
{
|
||||
class logging
|
||||
|
|
|
@ -51,8 +51,24 @@ on (true)
|
|||
{
|
||||
process_packets ();
|
||||
}
|
||||
catch (boost::system::error_code & ec)
|
||||
{
|
||||
BOOST_LOG (this->node.log) << FATAL_LOG_PREFIX << ec.message ();
|
||||
release_assert (false);
|
||||
}
|
||||
catch (std::error_code & ec)
|
||||
{
|
||||
BOOST_LOG (this->node.log) << FATAL_LOG_PREFIX << ec.message ();
|
||||
release_assert (false);
|
||||
}
|
||||
catch (std::runtime_error & err)
|
||||
{
|
||||
BOOST_LOG (this->node.log) << FATAL_LOG_PREFIX << err.what ();
|
||||
release_assert (false);
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
BOOST_LOG (this->node.log) << FATAL_LOG_PREFIX << "Unknown exception";
|
||||
release_assert (false);
|
||||
}
|
||||
if (this->node.config.logging.network_packet_logging ())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue