LCCD  1.5.0
lccd_exceptions.h
1 #ifndef LCCD_EXCEPTION_H
2 #define LCCD_EXCEPTION_H 1
3 
4 #include <string>
5 #include <exception>
6 #include "lccd.h"
7 
8 // define some exceptions similar to the ones used in lcio
9 // the exceptions should be part of the corresponding namespace
10 // even though they are not defined in the package (subdirectory)
11 // as these hold interfaces (abstract base classes) only ....
12 
13 namespace lccd{
14 
19  class LCCDException : public std::exception{
20 
21  protected:
22  std::string message{} ;
23 
24  LCCDException(){ /*no_op*/ ; }
25 
26  public:
27  virtual ~LCCDException() throw() { /*no_op*/; }
28 
29  LCCDException( const std::string& text ) {
30  message = "lccd::Exception: " + text ;
31  }
32 
33  virtual const char* what() const throw() { return message.c_str() ; }
34  };
35 
41 
42  protected:
43  DatabaseException() { /*no_op*/ ; }
44  public:
45  virtual ~DatabaseException() throw() { /*no_op*/; }
46 
47  DatabaseException( std::string text ){
48  message = "lccd::DatabaseException: " + text ;
49  }
50  };
51 
57 
58  public:
59  virtual ~DataNotAvailableException() throw() { /*no_op*/; }
60 
61  DataNotAvailableException( std::string text ) {
62  message = "lccd::DataNotAvailableException: " + text ;
63  }
64  };
65 
71 
72  public:
73  virtual ~ReadOnlyException() throw() { /*no_op*/; }
74 
75  ReadOnlyException( std::string text ){
76  message = "lccd::ReadOnlyException: " + text ;
77  }
78  };
79 
85 
86  public:
87  virtual ~InconsistencyException() throw() { /*no_op*/; }
88 
89  InconsistencyException( std::string text ) {
90  message = "lccd::InconsistencyException: " + text ;
91  }
92  };
93 
99 
100  public:
101  virtual ~MemberNotImplementedException() throw() { /*no_op*/; }
102 
103  MemberNotImplementedException( std::string text ) {
104  message = "lccd::MemberNotImplementedException: " + text ;
105  }
106  };
107 
108 
109 } // namespace
110 
111 #endif /* ifndef LCCD_EXCEPTION_H */
Exception used for (possible) inconsistency warnings.
Definition: lccd_exceptions.h:84
Exception used for general LCCD errors.
Definition: lccd_exceptions.h:19
Exception used for data not available.
Definition: lccd_exceptions.h:56
Exception used for not implemented member functions.
Definition: lccd_exceptions.h:98
Exception used for signaling a &#39;read only exception&#39;.
Definition: lccd_exceptions.h:70
DatabaseException used for errors accessing the database data.
Definition: lccd_exceptions.h:40