18 #include "gsl/gsl_errno.h"
42 declareProperty(
"ErrorPolicy" , m_errorPolicy ) ;
43 declareProperty(
"Handlers" , m_handlersTypeNames ) ;
44 declareProperty(
"IgnoreCodes" , m_ignore ) ;
62 <<
" Error in initialization of base class 'Service'"<<
endmsg;
70 { gsl_set_error_handler_off() ; }
72 { gsl_set_error_handler (
nullptr ) ; }
82 <<
" Valid policies: "
83 <<
"[ 'GSL' , 'Off' , 'Abort' , 'Ignore' , 'Exception' , 'Handle' ]"
89 GslErrorHandler
handler = gsl_set_error_handler(
nullptr );
90 gsl_set_error_handler( handler );
93 <<
" GSL Error Handler is '"
96 else {
info() <<
" Error Handler is NULL" <<
endmsg ; }
103 error() <<
" Could not locate Tool Service! " <<
endmsg;
108 auto pos = it.find(
'/');
110 if( pos != std::string::npos ) {
111 sc = toolsvc->retrieveTool
112 ( it.substr( 0 , pos ), it.substr( pos + 1 ), eh , this ) ;
114 sc = toolsvc->retrieveTool( it , it , eh ,
this ) ;
118 <<
" Could not retrieve tool '" << it <<
"'"<<
endmsg ;
122 <<
" Could not retrieve tool '" << it <<
"'"<<
endmsg ;
158 GslErrorHandler hh = gsl_set_error_handler(
nullptr );
159 gsl_set_error_handler( hh );
173 gsl_set_error_handler( handler );
175 debug() <<
" New GSL handler is set '"
209 if( m_ignore.end() !=
std::find( m_ignore.begin () ,
211 error.
code ) ) {
return sc ; }
213 for(
auto handler = m_handlers.begin() ;
214 sc.
isSuccess() && m_handlers.end() != handler ; ++handler )
215 { 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
SmartIF< ISvcLocator > & serviceLocator() const override
Retrieve pointer to service locator.
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
Helper class to represent GSL errors.
StatusCode finalize() override
MsgStream & info() const
shortcut for the method msgStream(MSG::INFO)
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.
StatusCode handle(const GslError &error) const override
handle the GSL error
void(* GslErrorHandler)(const char *, const char *, int, int)
type definition of "standard" GSL error handler functions
MsgStream & verbose() const
shortcut for the method msgStream(MSG::VERBOSE)
Names m_handlersTypeNames
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)
StatusCode service(const Gaudi::Utils::TypeNameString &name, T *&svc, bool createIf=true)
Templated method to access a service by name.
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
StatusCode initialize() override
standard service initialization
This class is used for returning status codes from appropriate routines.
The implementation of IGslSvc interface.
GslErrorHandler setHandler(GslErrorHandler handler) const override
set new GSL error handler
std::string m_errorPolicy
error policy
GslErrorHandler handler() const override
retrieve the current GSL error handler
MsgStream & debug() const
shortcut for the method msgStream(MSG::DEBUG)
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