18 #include "gsl/gsl_errno.h" 43 <<
" Error in initialization of base class 'Service'"<<
endmsg;
49 if (
"GSL" == m_errorPolicy ) { }
50 else if (
"Off" == m_errorPolicy )
51 { gsl_set_error_handler_off() ; }
52 else if (
"Abort" == m_errorPolicy )
53 { gsl_set_error_handler (
nullptr ) ; }
54 else if (
"Ignore" == m_errorPolicy )
56 else if (
"Exception" == m_errorPolicy )
58 else if (
"Handle" == m_errorPolicy )
62 <<
" Unknown Error policy '" << m_errorPolicy <<
"'" 63 <<
" Valid policies: " 64 <<
"[ 'GSL' , 'Off' , 'Abort' , 'Ignore' , 'Exception' , 'Handle' ]" 70 GslErrorHandler handler = gsl_set_error_handler(
nullptr );
71 gsl_set_error_handler( handler );
74 <<
" GSL Error Handler is '" 77 else { info() <<
" Error Handler is NULL" <<
endmsg ; }
79 if( !m_handlersTypeNames.empty() )
82 auto toolsvc = serviceLocator()->service<
IToolSvc>(
"ToolSvc");
84 error() <<
" Could not locate Tool Service! " <<
endmsg;
87 for(
const auto& it : m_handlersTypeNames )
89 auto pos = it.find(
'/');
91 if( pos != std::string::npos ) {
92 sc = toolsvc->retrieveTool
93 ( it.substr( 0 , pos ), it.substr( pos + 1 ), eh , this ) ;
95 sc = toolsvc->retrieveTool( it , it , eh ,
this ) ;
99 <<
" Could not retrieve tool '" << it <<
"'"<<
endmsg ;
103 <<
" Could not retrieve tool '" << it <<
"'"<<
endmsg ;
105 m_handlers.push_back( eh );
139 GslErrorHandler hh = gsl_set_error_handler(
nullptr );
140 gsl_set_error_handler( hh );
154 gsl_set_error_handler( handler );
156 debug() <<
" New GSL handler is set '" 192 error.
code ) ) {
return sc ; }
196 { sc = (*handler)->handle( error ); }
The abstract interface for arbitrary GSL error handler.
GAUDI_API void handleTheError(const char *reason, const char *file, int line, int code)
The simplest Gsl Error handler, It delegates the actual error handling to GSL Service.
StatusCode initialize() override
Helper class to represent GSL errors.
StatusCode finalize() override
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
bool isSuccess() const
Test for a status code of SUCCESS.
void(* GslErrorHandler)(const char *, const char *, int, int)
type definition of "standard" GSL error handler functions
Gaudi::Property< std::vector< int > > m_ignore
GAUDI_API void throwException(const char *reason, const char *file, int line, int code)
The simple Gsl Error handler, it throwns the Gaudi Exception.
bool isFailure() const
Test for a status code of FAILURE.
StatusCode finalize() override
standard service finalization
#define DECLARE_COMPONENT(type)
GslErrorHandler setHandler(GslErrorHandler handler) const override
set new GSL error handler
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
This class is used for returning status codes from appropriate routines.
The implementation of IGslSvc interface.
StatusCode handle(const GslError &error) const override
handle the GSL error
MsgStream & debug() const
shortcut for the method msgStream(MSG::DEBUG)
GslErrorHandler handler() const override
retrieve the current GSL error handler
static const IGslSvc * setGslSvc(const IGslSvc *value)
set new value for static Gaudi GSL Service
GAUDI_API void ignoreTheError(const char *reason, const char *file, int line, int code)
The simplest Gsl Error handler, It simply ingnores the error.
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
StatusCode status(const int error) const override
transform GSL error code to Gaudi status code