All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
GslErrorException.cpp
Go to the documentation of this file.
1 // ============================================================================
2 // Include files
3 // from Gaudi
4 #include "GaudiKernel/GaudiException.h"
5 // STD & STL
6 #include <algorithm>
7 #include <string>
8 // local
9 #include "GslErrorException.h"
10 
11 // ============================================================================
19 // ============================================================================
20 
21 // ============================================================================
27 // ============================================================================
29 ( const std::string& type ,
30  const std::string& name ,
31  const IInterface* parent )
32  : base_class ( type, name , parent )
33 {
34  declareProperty ( "IgnoreCodes" , m_ignore );
35 }
36 // ============================================================================
37 
38 // ============================================================================
39 
40 // ============================================================================
47 // ============================================================================
49 ( const GslError& error ) const
50 {
51  // throw if code is not in the list of codes to be ignored
52  if( m_ignore.end() == std::find( m_ignore.begin () ,
53  m_ignore.end () ,
54  error.code ) ) {
55  throw GaudiException( " GSL ErrorCode=" + std::to_string( error.code ) +
56  ": '" + error.reason +
57  "' in the file '" + error.file +
58  "' at line " + std::to_string(error.line)
59  , "*GLS Error*" , StatusCode::FAILURE );
60  }
62  return StatusCode::SUCCESS ;
63 }
64 // ============================================================================
65 
67 
68 // ============================================================================
69 // The END
70 // ============================================================================
std::string reason
error message ('reason')
Definition: GslError.h:19
string to_string(const T &value)
Definition: mergesort.cpp:40
std::string file
file name
Definition: GslError.h:21
Define general base for Gaudi exception.
Helper class to represent GSL errors.
Definition: GslError.h:15
int code
error code (GSL)
Definition: GslError.h:25
int line
line number
Definition: GslError.h:23
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
#define DECLARE_COMPONENT(type)
Definition: PluginService.h:36
Definition of the basic interface.
Definition: IInterface.h:234
GslErrorException(const std::string &type, const std::string &name, const IInterface *parent)
Standard constructor.
StatusCode handle(const GslError &error) const override
handle the GSL error
Base class used to extend a class implementing other interfaces.
Definition: extends.h:10
Concrete GSL eror handler It is just thrown the exception.
string type
Definition: gaudirun.py:151