34 #include "ExceptionHandler.hh"
37 #include "canvas/Utilities/Exception.h"
39 #include "art/Utilities/Exception.h"
41 #include "cetlib/exception.h"
42 #include "messagefacility/MessageLogger/MessageLogger.h"
44 #include <boost/exception/all.hpp>
50 void ExceptionHandler(ExceptionHandlerRethrow decision, std::string optional_message) {
52 if (optional_message !=
"") {
53 mf::LogError(
"ExceptionHandler") << optional_message;
58 }
catch (
const art::Exception& e) {
60 mf::LogError(
"ExceptionHandler") <<
"art::Exception object caught:" <<
61 " returnCode = " << e.returnCode() <<
62 ", categoryCode = " << e.categoryCode() <<
63 ", category = " << e.category();
64 mf::LogError(
"ExceptionHandler") <<
"art::Exception object stream:" << e;
66 if (decision == ExceptionHandlerRethrow::yes) {
throw; }
68 }
catch (
const cet::exception &e) {
70 mf::LogError(
"ExceptionHandler") <<
"cet::exception object caught:" <<
73 if (decision == ExceptionHandlerRethrow::yes) {
throw; }
75 }
catch (
const boost::exception& e) {
77 mf::LogError(
"ExceptionHandler") <<
"boost::exception object caught: " <<
78 boost::diagnostic_information(e);
80 if (decision == ExceptionHandlerRethrow::yes) {
throw; }
82 }
catch (
const std::exception& e ) {
84 mf::LogError (
"ExceptionHandler") <<
"std::exception caught: " << e.what();
86 if (decision == ExceptionHandlerRethrow::yes) {
throw; }
90 mf::LogError (
"ExceptionHandler") <<
"Exception of type unknown to artdaq::ExceptionHandler caught";
92 if (decision == ExceptionHandlerRethrow::yes) {
throw; }