18 #include "gsl/gsl_errno.h" 42 error() <<
" Error in initialization of base class 'Service'" <<
endmsg;
48 if (
"GSL" == m_errorPolicy ) {
49 }
else if (
"Off" == m_errorPolicy ) {
50 gsl_set_error_handler_off();
51 }
else if (
"Abort" == m_errorPolicy ) {
52 gsl_set_error_handler(
nullptr );
53 }
else if (
"Ignore" == m_errorPolicy ) {
55 }
else if (
"Exception" == m_errorPolicy ) {
57 }
else if (
"Handle" == m_errorPolicy ) {
60 error() <<
" Unknown Error policy '" << m_errorPolicy <<
"'" 61 <<
" Valid policies: " 62 <<
"[ 'GSL' , 'Off' , 'Abort' , 'Ignore' , 'Exception' , 'Handle' ]" <<
endmsg;
67 GslErrorHandler handler = gsl_set_error_handler(
nullptr );
68 gsl_set_error_handler( handler );
72 info() <<
" Error Handler is NULL" <<
endmsg;
75 if ( !m_handlersTypeNames.empty() ) {
77 auto toolsvc = serviceLocator()->service<
IToolSvc>(
"ToolSvc" );
79 error() <<
" Could not locate Tool Service! " <<
endmsg;
82 for (
const auto& it : m_handlersTypeNames ) {
83 auto pos = it.find(
'/' );
85 if ( pos != std::string::npos ) {
86 sc = toolsvc->retrieveTool( it.substr( 0, pos ), it.substr( pos + 1 ), eh, this );
88 sc = toolsvc->retrieveTool( it, it, eh,
this );
91 error() <<
" Could not retrieve tool '" << it <<
"'" <<
endmsg;
95 error() <<
" Could not retrieve tool '" << it <<
"'" <<
endmsg;
98 m_handlers.push_back( eh );
132 GslErrorHandler hh = gsl_set_error_handler(
nullptr );
133 gsl_set_error_handler( hh );
146 gsl_set_error_handler( handler );
163 if ( GSL_SUCCESS == error ) {
189 sc = ( *handler )->handle( error );
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.
constexpr static const auto FAILURE
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.
static const IGslSvc * setGslSvc(const IGslSvc *value)
set new value for static Gaudi GSL Service
The abstract interface for arbitrary GSL error handler.
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.
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.
void(* GslErrorHandler)(const char *, const char *, int, int)
type definition of "standard" GSL error handler functions
The implementation of IGslSvc interface.
constexpr static const auto SUCCESS
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
std::vector< IGslErrorHandler * > m_handlers
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