28#include <boost/regex.hpp>
36inline
void toupper(
std::
string& s ) { std::transform( s.begin(), s.end(), s.begin(), (int ( * )(
int ))
toupper ); }
42 if ( status.
isFailure() ) {
return status; }
46 auto loc = key.find(
" " );
47 std::string mode = key.substr( 0, loc );
51 if ( mode ==
"NONE" ) {
53 }
else if ( mode ==
"ALL" ) {
56 error() <<
"Unknown mode for Exception handling: \"" << mode <<
"\". Default must be one of \"ALL\" or \"NONE\""
62 if ( loc == string::npos ) {
65 key = key.substr( loc + 1 );
70 static const boost::regex exp{
"[[:space:]]*([^[:space:]]+)[[:space:]]*=[[:space:]]*([^[:space:]]+)" };
71 static const auto tok_end = boost::sregex_iterator();
72 for (
auto tok_iter = boost::sregex_iterator( begin( key ), end( key ), exp ); tok_iter != tok_end; ++tok_iter ) {
73 TAG = ( *tok_iter )[1];
74 VAL = ( *tok_iter )[2];
77 if ( VAL ==
"SUCCESS" ) {
79 }
else if ( VAL ==
"FAILURE" ) {
81 }
else if ( VAL ==
"REVOVERABLE" ) {
83 }
else if ( VAL ==
"RETHROW" ) {
85 }
else if ( VAL ==
"DEFAULT" ) {
88 error() <<
"In JobOpts: unknown return code \"" << VAL <<
"\" for Algorithm " << TAG << std::endl
89 <<
" Must be one of: DEFAULT, SUCCESS, FAILURE, RECOVERABLE, RETHROW" <<
endmsg;
95 debug() <<
"Will catch exceptions thrown by: " << TAG <<
" -> action: " << VAL <<
endmsg;
101 loc = key.find(
" " );
102 mode = key.substr( 0, loc );
106 if ( mode ==
"NONE" ) {
108 }
else if ( mode ==
"ALL" ) {
111 error() <<
"Unknown mode for Error handling: \"" << mode <<
"\". Default must be one of \"ALL\" or \"NONE\""
117 if ( loc == string::npos ) {
120 key = key.substr( loc + 1 );
123 for (
auto tok_iter = boost::sregex_iterator( begin( key ), end( key ), exp ); tok_iter != tok_end; ++tok_iter ) {
124 TAG = ( *tok_iter )[1];
125 VAL = ( *tok_iter )[2];
128 if ( VAL ==
"SUCCESS" ) {
130 }
else if ( VAL ==
"FAILURE" ) {
132 }
else if ( VAL ==
"RECOVERABLE" ) {
135 error() <<
"In JobOpts: unknown return code \"" << VAL <<
"\" for Algorithm " << TAG << std::endl
136 <<
" Must be one of: SUCCESS, FAILURE, RECOVERABLE" <<
endmsg;
142 debug() <<
"Will process Errors returned by: " << TAG <<
" -> action: " << VAL <<
endmsg;
155 switch ( i->second ) {
186 switch ( i->second ) {
void toupper(std::string &s)
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
#define DECLARE_COMPONENT(type)
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
MsgStream & debug() const
shortcut for the method msgStream(MSG::DEBUG)
MSG::Level msgLevel() const
Simple implementation of IExceptionSvc abstract interface.
std::map< std::string, ReturnState > m_retCodesErr
StatusCode handle(const INamedInterface &o, const GaudiException &e) const override
Handle caught GaudiExceptions.
StatusCode handleErr(const INamedInterface &o, const StatusCode &s) const override
Handle errors.
Gaudi::Property< std::string > m_mode_exc_s
StatusCode initialize() override
initialize the service
Gaudi::Property< std::string > m_mode_err_s
std::map< std::string, ReturnState > m_retCodesExc
virtual StatusCode process(const INamedInterface &o) const
Define general base for Gaudi exception.
IInterface compliant class extending IInterface with the name() method.
Gaudi::StateMachine::State m_state
Service state.
StatusCode initialize() override
This class is used for returning status codes from appropriate routines.
constexpr static const auto RECOVERABLE
constexpr static const auto SUCCESS
constexpr static const auto FAILURE