11 #include "GaudiKernel/ISvcLocator.h"
18 #include <boost/regex.hpp>
28 std::transform(s.begin(), s.end(), s.begin(),
54 if ( status.
isFailure() ) {
return status ; }
58 auto loc = key.find(
" ");
59 std::string mode = key.substr(0,loc);
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) {
75 key = key.substr(loc+1);
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;
112 mode = key.substr(0,loc);
120 <<
"\". Default must be one of \"ALL\" or \"NONE\"" <<
endmsg;
125 if (loc == string::npos) {
128 key = key.substr(loc+1);
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()
221 const std::exception & exc )
const
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
Define general base for Gaudi exception.
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
ExceptionSvc()=delete
no default constructor
auto begin(reverse_wrapper< T > &w)
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.
virtual const std::string & name() const =0
Retrieve the name of the instance.
StringProperty m_mode_err_s
int ALL
message levels --------------------------------------------------------—
auto end(reverse_wrapper< T > &w)
This class is used for returning status codes from appropriate routines.
#define DECLARE_COMPONENT(type)
Simple implementation of IExceptionSvc abstract interface.
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.
Base class used to extend a class implementing other interfaces.
void setLevel(int level)
Update outputlevel.
virtual StatusCode process(const INamedInterface &o) const
void toupper(std::string &s)