27 std::transform(s.begin(), s.end(), s.begin(),
37 , m_mode_exc (
ALL ), m_mode_err( NONE )
38 , m_log(msgSvc(), name )
61 if ( status.
isFailure() ) {
return status ; }
65 string::size_type loc = key.find(
" ");
67 if (loc == std::string::npos) {
70 mode = key.substr(0,loc);
77 }
else if (mode ==
"ALL") {
80 m_log <<
MSG::ERROR <<
"Unknown mode for Exception handling: \"" << mode
81 <<
"\". Default must be one of \"ALL\" or \"NONE\"" <<
endmsg;
86 if (loc == string::npos) {
89 key = key.substr(loc+1,key.length());
93 std::string val,VAL,TAG;
95 tok.
analyse( key,
" ",
"",
"",
"=",
"",
"");
97 for ( Tokenizer::Items::iterator
i = tok.
items().begin();
99 const std::string& tag = (*i).tag();
106 if (VAL ==
"SUCCESS") {
108 }
else if ( VAL ==
"FAILURE" ) {
110 }
else if ( VAL ==
"REVOVERABLE" ) {
112 }
else if ( VAL ==
"RETHROW" ) {
114 }
else if ( VAL ==
"DEFAULT" ) {
118 <<
"\" for Algorithm " << TAG << std::endl
119 <<
" Must be one of: DEFAULT, SUCCESS, FAILURE, RECOVERABLE, RETHROW"
126 <<
" -> action: " << VAL <<
endmsg;
135 if (loc == std::string::npos) {
138 mode = key.substr(0,loc);
143 if (mode ==
"NONE") {
145 }
else if (mode ==
"ALL") {
149 <<
"\". Default must be one of \"ALL\" or \"NONE\"" <<
endmsg;
154 if (loc == string::npos) {
157 key = key.substr(loc+1,key.length());
161 tok2.
analyse( key,
" ",
"",
"",
"=",
"",
"");
163 for ( Tokenizer::Items::iterator
i = tok2.
items().begin();
164 i != tok2.
items().end();
i++) {
165 const std::string& tag = (*i).tag();
172 if (VAL ==
"SUCCESS") {
174 }
else if ( VAL ==
"FAILURE" ) {
176 }
else if ( VAL ==
"RECOVERABLE" ) {
180 <<
"\" for Algorithm " << TAG << std::endl
181 <<
" Must be one of: SUCCESS, FAILURE, RECOVERABLE"
188 <<
" -> action: " << VAL <<
endmsg;
213 if (m_retCodesErr.find(alg.
name()) != m_retCodesErr.end()) {
233 if (m_mode_err ==
ALL) {
238 assert (m_mode_err == NONE );
253 if (m_retCodesExc.find(alg.
name()) != m_retCodesExc.end()) {
272 if (m_mode_exc ==
ALL) {
275 assert (m_mode_exc == NONE);
287 m_log <<
MSG::DEBUG <<
"Handling unknown exception for " << alg.
name()
296 const std::exception & exc )
const
298 m_log <<
MSG::DEBUG <<
"Handling std:except: \"" << exc.what() <<
"\" for "
301 return process(alg) ;
310 m_log <<
MSG::DEBUG <<
"Handling GaudiException: \"" << exc <<
"\" for "
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...
Gaudi::StateMachine::State m_state
Service state.
Items & items()
Access token collection.
virtual StatusCode initialize()
initialize the service
std::map< std::string, ReturnState > m_retCodesErr
virtual StatusCode handleErr(const INamedInterface &o, const StatusCode &s) const
Handle errors.
virtual StatusCode handle(const INamedInterface &o, const GaudiException &e) const
Handle caught GaudiExceptions.
void analyse(const std::string &s, const char *delim, const char *tagBegin, const char *tagEnd, const char *eq, const char *valBegin, const char *valEnd)
Analyse tokens from string.
bool isFailure() const
Test for a status code of FAILURE.
#define DECLARE_COMPONENT(type)
virtual const std::string & name() const =0
Retrieve the name of the instance.
StringProperty m_mode_err_s
ExceptionSvc()
no default constructor
This class is used for returning status codes from appropriate routines.
Simple implementation of IExceptionSvc abstract interface.
StringProperty m_mode_exc_s
const TYPE & value() const
explicit conversion
std::map< std::string, ReturnState > m_retCodesExc
IInterface compliant class extending IInterface with the name() method.
virtual StatusCode initialize()
Initialization (from CONFIGURED to INITIALIZED).
virtual StatusCode finalize()
finalize the service
void setLevel(int level)
Update outputlevel.
Templated class to add the standard messaging functionalities.
virtual ~ExceptionSvc()
Destructor.
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)
virtual StatusCode finalize()
Finalize (from INITIALIZED to CONFIGURED).
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.