18 #include <boost/regex.hpp>
54 if ( status.
isFailure() ) {
return status ; }
58 auto loc = key.
find(
" ");
66 m_log <<
MSG::ERROR <<
"Unknown mode for Exception handling: \"" << mode
67 <<
"\". Default must be one of \"ALL\" or \"NONE\"" <<
endmsg;
72 if (loc == string::npos) {
80 static const boost::regex
exp{
"[[:space:]]*([^[:space:]]+)[[:space:]]*=[[:space:]]*([^[:space:]]+)"};
81 static const auto tok_end = boost::sregex_iterator();
82 for (
auto tok_iter = boost::sregex_iterator(
begin(key),
end(key),
exp);
83 tok_iter != tok_end; ++tok_iter)
96 <<
"\" for Algorithm " << TAG <<
std::endl
97 <<
" Must be one of: DEFAULT, SUCCESS, FAILURE, RECOVERABLE, RETHROW"
104 <<
" -> action: " << VAL <<
endmsg;
120 <<
"\". Default must be one of \"ALL\" or \"NONE\"" <<
endmsg;
125 if (loc == string::npos) {
131 for (
auto tok_iter = boost::sregex_iterator(
begin(key),
end(key),
exp);
132 tok_iter != tok_end; ++tok_iter)
134 TAG = (*tok_iter)[1];
135 VAL = (*tok_iter)[2];
143 <<
"\" for Algorithm " << TAG <<
std::endl
144 <<
" Must be one of: SUCCESS, FAILURE, RECOVERABLE"
151 <<
" -> action: " << VAL <<
endmsg;
165 auto i = m_retCodesErr.find(alg.
name());
166 if (
i != m_retCodesErr.
end()) {
167 switch (
i->second ) {
179 assert (m_mode_err == NONE );
192 auto i = m_retCodesExc.find(alg.
name());
193 if (
i != m_retCodesExc.
end()) {
195 switch (
i->second ) {
204 if (m_mode_exc ==
ALL) {
throw; }
205 assert (m_mode_exc == NONE);
213 m_log <<
MSG::DEBUG <<
"Handling unknown exception for " << alg.
name()
223 m_log <<
MSG::DEBUG <<
"Handling std:except: \"" << exc.
what() <<
"\" for "
225 return process(alg) ;
233 m_log <<
MSG::DEBUG <<
"Handling GaudiException: \"" << exc <<
"\" for "
StatusCode initialize() override
IntegerProperty m_outputLevel
Service output level.
int ALL
message levels --------------------------------------------------------—
Define general base for Gaudi exception.
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
ExceptionSvc()=delete
no default constructor
Gaudi::StateMachine::State m_state
Service state.
std::map< std::string, ReturnState > m_retCodesErr
StatusCode handle(const INamedInterface &o, const GaudiException &e) const override
Handle caught GaudiExceptions.
bool isFailure() const
Test for a status code of FAILURE.
#define DECLARE_COMPONENT(type)
auto begin(reverse_wrapper< T > &w)
virtual const std::string & name() const =0
Retrieve the name of the instance.
StringProperty m_mode_err_s
This class is used for returning status codes from appropriate routines.
Simple implementation of IExceptionSvc abstract interface.
auto end(reverse_wrapper< T > &w)
StringProperty m_mode_exc_s
StatusCode initialize() override
initialize the service
const TYPE & value() const
explicit conversion
StatusCode handleErr(const INamedInterface &o, const StatusCode &s) const override
Handle errors.
std::map< std::string, ReturnState > m_retCodesExc
IInterface compliant class extending IInterface with the name() method.
void setLevel(int level)
Update outputlevel.
virtual StatusCode process(const INamedInterface &o) const
Property * declareProperty(const std::string &name, T &property, const std::string &doc="none") const
Declare the named property.
void toupper(std::string &s)
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.