34 #include "ExceptionHandler.hh"
36 #include "canvas/Utilities/Exception.h"
37 #include "cetlib/exception.h"
38 #include "messagefacility/MessageLogger/MessageLogger.h"
40 #include <boost/exception/all.hpp>
46 void ExceptionHandler(ExceptionHandlerRethrow decision, std::string optional_message) {
48 if (optional_message !=
"") {
49 mf::LogError(
"ExceptionHandler") << optional_message;
54 }
catch (
const art::Exception& e) {
56 mf::LogError(
"ExceptionHandler") <<
"art::Exception object caught:" <<
57 " returnCode = " << e.returnCode() <<
58 ", categoryCode = " << e.categoryCode() <<
59 ", category = " << e.category();
60 mf::LogError(
"ExceptionHandler") <<
"art::Exception object stream:" << e;
62 if (decision == ExceptionHandlerRethrow::yes) {
throw; }
64 }
catch (
const cet::exception &e) {
66 mf::LogError(
"ExceptionHandler") <<
"cet::exception object caught:" <<
69 if (decision == ExceptionHandlerRethrow::yes) {
throw; }
71 }
catch (
const boost::exception& e) {
73 mf::LogError(
"ExceptionHandler") <<
"boost::exception object caught: " <<
74 boost::diagnostic_information(e);
76 if (decision == ExceptionHandlerRethrow::yes) {
throw; }
78 }
catch (
const std::exception& e ) {
80 mf::LogError (
"ExceptionHandler") <<
"std::exception caught: " << e.what();
82 if (decision == ExceptionHandlerRethrow::yes) {
throw; }
86 mf::LogError (
"ExceptionHandler") <<
"Exception of type unknown to artdaq::ExceptionHandler caught";
88 if (decision == ExceptionHandlerRethrow::yes) {
throw; }