The GslSvc is the service which perform intelligent error handling for GSL (GNU Scientific Library). It provides a choice between different "Error Handling Policies". The current implementation supports the following ones, which are driven by "ErrorPolicy" property of class GslSvc:
Current implementation of this method is sequential execution of declared handlers, defined thought the property "Handlers" of class GslSvc in a format:
GslSvc.Handlers = { "H1Type/H1Name" , "H2Type/H2Name" , "H3ype/3Name" };
The "handlers" must implement IGslErrorHandler interface. The three concrete simple handlers are provided in GaudiGSL package:
class GslErorCount, GslErrorPrint and GslErrorException.
Typical job-configurations:
// This configuration perform the "on-flight" printout of all GSL // errors and the printout of overall statistics of all errors // at the end of the job
ApplicationMgr.DLLs += { "GaudiGSL" }; ApplicationMgr.ExtSvc += { "GslSvc" }; ApplicationMgr.ErrorPolicy = "Handle" ; ApplicationMgr.Handlers += { "GslErrorPrint/GslPrint" }; ApplicationMgr.Handlers += { "GslErrorCount/GslCount" };
// This configuration is good for massive production. // Program continues after any error, so the return values from // any library routines must be checked. This policy is recommended // by GSL team for production programs
ApplicationMgr.DLLs += { "GaudiGSL" }; ApplicationMgr.ExtSvc += { "GslSvc" }; ApplicationMgr.ErrorPolicy = "Off" ;
// This configuration corresponds to default GSL behaviour and // functional it is equivalent to the absence of special error // handling at all. Program just makes abortion on errors.
ApplicationMgr.DLLs += { "GaudiGSL" }; ApplicationMgr.ExtSvc += { "GslSvc" }; ApplicationMgr.ErrorPolicy = "Abort" ;
// Under this configuration on the error the handler throws // GaudiException with tag = *GSL Error*
ApplicationMgr.DLLs += { "GaudiGSL" }; ApplicationMgr.ExtSvc += { "GslSvc" }; ApplicationMgr.ErrorPolicy = "Exception" ;
// This configuration is similar to the previous one // but GaudiException is throwed by specialized handler, and // thus it could be combined in a sequence with other // specialized handlers
ApplicationMgr.DLLs += { "GaudiGSL" }; ApplicationMgr.ExtSvc += { "GslSvc" }; ApplicationMgr.ErrorPolicy = "Handle" ;
// "Everything altogether" configuration. // It prints the error message, accumulate statistics of errors // and throws the exception
ApplicationMgr.DLLs += { "GaudiGSL" }; ApplicationMgr.ExtSvc += { "GslSvc" }; ApplicationMgr.ErrorPolicy = "Handle" ; ApplicationMgr.Handlers += { "GslErrorPrint/GslPrint" }; ApplicationMgr.Handlers += { "GslErrorCount/GslCount" }; ApplicationMgr.Handlers += { "GslErrorException/GslException" };
The handling of some error codes could be suppressed explicitly, e.g.:
GslSvc.IgnoreCodes = { 0 , 15 , -1 , 158 } ;
(this option is valid only for "Handle" mode). In addition one could forbid the exception throws for certain error codes:
GslException.IgnoreCodes = { 0 , -1 };