The Gaudi Framework  v29r0 (ff2e7097)
GslErrorHandlers.cpp
Go to the documentation of this file.
1 // ============================================================================
2 // Include files
3 // GaudiKernel
5 // GaudiGSL
6 #include "GaudiGSL/GslError.h"
7 #include "GaudiGSL/IGslSvc.h"
8 // local
9 #include "GaudiGSL/GaudiGSL.h"
11 
12 #include <sstream>
13 
23 void GslErrorHandlers::ignoreTheError( const char* /* reason */, const char* /* file */, int /* line */,
24  int /* code */ )
25 {
26 }
27 
28 void GslErrorHandlers::handleTheError( const char* reason, const char* file, int line, int code )
29 {
30  // het the GSL service
31  const IGslSvc* svc = GaudiGSL::gslSvc();
32  // handle the error if service is valid
33  if ( nullptr != svc ) {
34  svc->handle( GslError( reason, file, line, code ) );
35  }
36 }
37 
38 void GslErrorHandlers::throwException( const char* reason, const char* file, int line, int code )
39 {
40  std::ostringstream error;
41  error << " GSL ErrorCode=" << code << ": '" << reason << "' in the file '" << file << "' at the line " << line;
42  throw GaudiException( error.str(), "*GLS Error*", StatusCode::FAILURE );
43 }
44 
45 // ============================================================================
46 // The END
47 // ============================================================================
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.
Define general base for Gaudi exception.
Helper class to represent GSL errors.
Definition: GslError.h:16
static const IGslSvc * gslSvc()
static accessor to Gaudi GSL Service
Definition: GaudiGSL.cpp:30
GAUDI_API void throwException(const char *reason, const char *file, int line, int code)
The simple Gsl Error handler, it throwns the Gaudi Exception.
The abstract interface to "deal" with GNU Scientific Library (GLS) The main task is the error handlin...
Definition: IGslSvc.h:16
virtual StatusCode handle(const GslError &error) const =0
handle the GSL error
GAUDI_API void ignoreTheError(const char *reason, const char *file, int line, int code)
The simplest Gsl Error handler, It simply ingnores the error.