1 #include "ExceptionHandler.hh"
3 #include "canvas/Utilities/Exception.h"
4 #include "cetlib/exception.h"
7 #include <boost/exception/all.hpp>
10 #define TRACE_NAME "ExceptionHandler"
16 if (optional_message !=
"")
18 TLOG(TLVL_ERROR) << optional_message;
25 catch (
const art::Exception& e)
27 TLOG(TLVL_ERROR) <<
"art::Exception object caught:" <<
28 " returnCode = " << std::to_string(e.returnCode()) <<
29 ", categoryCode = " << e.categoryCode() <<
30 ", category = " << e.category();
31 TLOG(TLVL_ERROR) <<
"art::Exception object stream:" << e;
35 catch (
const cet::exception& e)
37 TLOG(TLVL_ERROR) <<
"cet::exception object caught:" <<
42 catch (
const boost::exception& e)
44 TLOG(TLVL_ERROR) <<
"boost::exception object caught: " <<
45 boost::diagnostic_information(e);
49 catch (
const std::exception& e)
51 TLOG(TLVL_ERROR) <<
"std::exception caught: " << e.what();
57 TLOG(TLVL_ERROR) <<
"Exception of type unknown to artdaq::ExceptionHandler caught";
ExceptionHandlerRethrow
Controls whether the ExceptionHandler will rethrow after printing exception details.
Rethrow the exception after sending details to MessageFacility.
void ExceptionHandler(ExceptionHandlerRethrow decision, std::string optional_message)
The ExceptionHandler class prints out all available information about an excection, then optionally re-throws.