TPCCondData
TPCCondDataExeptions.h
Go to the documentation of this file.
1 #ifndef TPCCONDDATA_EXCEPTION_H
2 #define TPCCONDDATA_EXCEPTION_H 1
3 
4 #include <string>
5 #include <exception>
6 
7 /*
8  * Define some exceptions similar to the ones used in hep.lcd.io
9  * The exceptions should be part of the corresponding namespace,
10  * therefore some exceptions were duplicated here from marlintpc/general.
11  */
12 
13 namespace tpcconddata
14 {
15 
20  class Exception : public std::exception
21  {
22 
23  protected:
24  std::string message;
25 
27  { /*no_op*/
28  ;
29  }
30 
31 
32  public:
33  virtual ~Exception() throw()
34  { /*no_op*/
35  ;
36  }
37 
38 
39  Exception(const std::string& text)
40  {
41  message = "tpcconddata::Exception: " + text;
42  }
43 
44  Exception(const std::string& ClassName, const std::string& Message) :
45  message(std::string("marlintpc::Exception in object of class ")
46  + ClassName + " : " + Message)
47  { /*no_op*/
48  ;
49  }
50 
51  virtual const char* what() const throw()
52  {
53  return (message.c_str());
54  }
55 
56 
57  };
58 
63  {
64 
65  protected:
67  { /*no_op*/
68  ;
69  }
70 
71  public:
72  virtual ~ConditionsObjectException() throw()
73  { /*no_op*/
74  ;
75  }
76 
77 
78  ConditionsObjectException(std::string text)
79  {
80  message = "tpcconddata::ConditionsObjectException: " + text;
81  }
82  };
83 
88  {
89 
90  public:
92  { /*no_op*/
93  ;
94  }
95 
96 
98  {
99  message = "tpcconditions::CondDataNotAvailableException: " + text;
100  }
101 
102  };
103 
108  {
109 
110  public:
112  { /*no_op*/
113  ;
114  }
115 
116 
118  {
119  message = "tpcconditions::CondDataWrongObjectException: " + text;
120  }
121 
122  };
123 
130  {
131  public:
132  virtual ~InvalidDataException() throw()
133  { /*no_op*/
134  }
136  Exception("The data is not valid.")
137  { /*no_op*/
138  }
139 
140  InvalidDataException(const std::string &err) :
141  Exception(err)
142  { /*no_op*/
143  }
144 
145  InvalidDataException(const std::string& ClassName,
146  const std::string& Message) :
147  Exception(ClassName, Message)
148  { /*no_op*/
149  }
150  };
151 
152 } // namespace
153 
154 #endif /* ifndef TPCCONDDATA_EXCEPTION_H */
InvalidDataException(const std::string &ClassName, const std::string &Message)
ConditionObjectException used for errors accessing the event data.
InvalidDataException(const std::string &err)
Exception(const std::string &text)
Base exception for error involving some data having an invalid value.
ConditionsObjectException used for data not available.
Exception class for MarlinTPC conditions.
ConditionsObjectException used for wrong object.
Exception(const std::string &ClassName, const std::string &Message)
virtual const char * what() const