1 #include "ExceptionHandler.hh"
3 #include "canvas/Utilities/Exception.h"
4 #include "cetlib/exception.h"
5 #include "messagefacility/MessageLogger/MessageLogger.h"
7 #include <boost/exception/all.hpp>
13 if (optional_message !=
"")
15 mf::LogError(
"ExceptionHandler") << optional_message;
22 catch (
const art::Exception& e)
24 mf::LogError(
"ExceptionHandler") <<
"art::Exception object caught:" <<
25 " returnCode = " << std::to_string(e.returnCode()) <<
26 ", categoryCode = " << e.categoryCode() <<
27 ", category = " << e.category();
28 mf::LogError(
"ExceptionHandler") <<
"art::Exception object stream:" << e;
32 catch (
const cet::exception& e)
34 mf::LogError(
"ExceptionHandler") <<
"cet::exception object caught:" <<
39 catch (
const boost::exception& e)
41 mf::LogError(
"ExceptionHandler") <<
"boost::exception object caught: " <<
42 boost::diagnostic_information(e);
46 catch (
const std::exception& e)
48 mf::LogError(
"ExceptionHandler") <<
"std::exception caught: " << e.what();
54 mf::LogError(
"ExceptionHandler") <<
"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.