AugerException.h
Go to the documentation of this file.
1 
7 #ifndef _utl_AugerException_h_
8 #define _utl_AugerException_h_
9 
10 #include <exception>
11 #include <string>
12 #include <sstream>
13 #include <map>
14 
15 
16 namespace utl {
17 
24  class AugerException : public std::exception {
25  public:
27  AugerException(const std::string& message = std::string())
28  : fMessage(message) { }
29 
31  virtual ~AugerException() throw() { }
32 
34  virtual std::string GetExceptionName() const
35  { return "Generic Exception in the Auger Offline Software"; }
36 
38  const std::string& GetMessage() const { return fMessage; }
39 
41  const char* what() const throw() { return fMessage.c_str(); }
42 
43  protected:
44  std::string fMessage;
45  };
46 
47 
60  public:
62  NonExistentComponentException(const std::string& message = std::string())
63  : AugerException(message) { }
64 
66  virtual std::string GetExceptionName() const
67  { return "Access to non-existent sub-component exception"; }
68  };
69 
70 
77  public:
79  IOFailureException(const std::string& message = std::string())
80  : AugerException(message) { }
81 
83  virtual std::string GetExceptionName() const
84  { return "IO failure exception"; }
85  };
86 
87 
102  public:
104  InvalidIteratorException(const std::string& message = std::string())
105  : AugerException(message) { }
106 
108  virtual std::string GetExceptionName() const
109  { return "Invalid Iterator Exception"; }
110  };
111 
112 
119  public:
121  OutOfBoundException(const std::string& message = std::string())
122  : AugerException(message) { }
123 
125  virtual std::string GetExceptionName() const
126  { return "Out of Bounds Exception"; }
127  };
128 
129 
145  public:
147  InitSequenceException(const std::string& message = std::string())
148  : AugerException(message) { }
149 
151  virtual std::string GetExceptionName() const
152  { return "Invalid order of initialisation and/or use"; }
153  };
154 
155 
170  public:
171  ModuleSequenceException(const std::string& message = std::string())
172  : AugerException(message) { }
173 
174  virtual std::string GetExceptionName() const
175  { return "Error during module sequencing"; }
176  };
177 
187  public:
188  NoDataForModelException(const std::string& message = std::string())
189  : AugerException(message) { }
190 
191  virtual std::string GetExceptionName() const
192  { return "Atmosphere model could not find data needed to perform "
193  "requested calculation."; }
194  };
195 
196 
214  public:
215  DataNotFoundInDBException(const std::string& table,
216  const std::string& column,
217  const std::map<std::string, std::string>& indexMap,
218  const std::string& time) :
219  fTableName(table),
220  fColumnName(column),
221  fIndexMap(indexMap),
222  fTime(time)
223  {
224  std::ostringstream msg;
225  msg << "Did not find requested data for:\n"
226  "Component name : " << fTableName << "\n"
227  "Component property: " << fColumnName << '\n';
228 
229  for (std::map<std::string, std::string>::const_iterator it = fIndexMap.begin();
230  it != fIndexMap.end(); ++it)
231  msg << " '" << it->first << "' = '" << it->second << "',\n";
232 
233  msg << "Detector time = " << fTime;
234 
235  fMessage = msg.str();
236  }
237 
238  DataNotFoundInDBException(const std::string& message = std::string())
239  : AugerException(message) { }
240 
242  virtual std::string GetExceptionName() const
243  { return "Could not locate requested data in the database"; }
244 
245  virtual ~DataNotFoundInDBException() throw() { }
246 
247  private:
248  std::string fTableName;
249  std::string fColumnName;
250  std::map<std::string, std::string> fIndexMap;
251  std::string fTime;
252  };
253 
254 
264  public:
266  XMLParseException(const std::string& message = std::string())
267  : AugerException(message) { }
268 
270  virtual std::string GetExceptionName() const
271  { return "XML Parse Exception"; }
272  };
273 
283  public:
285  XMLValidationException(const std::string& message = std::string())
286  : AugerException(message) { }
287 
289  virtual std::string GetExceptionName() const
290  { return "XML Validation Exception"; }
291  };
292 
293 
305  public:
307  MissingEventDataException(const std::string& message = std::string())
308  : AugerException(message) { }
309 
311  virtual std::string GetExceptionName() const
312  { return "Required data not present in the Event"; }
313  };
314 
315 
328  public:
330  InvalidConfigurationException(const std::string& message = std::string())
331  : AugerException(message) { }
332 
334  virtual std::string GetExceptionName() const
335  { return "Invalid configuration."; }
336  };
337 
338 
348  public:
350  DoesNotComputeException(const std::string& message = std::string())
351  : AugerException(message) { }
352 
354  virtual std::string GetExceptionName() const
355  { return "I'm sorry Dave, I'm afraid I can't do that."; }
356  };
357 
358 }
359 
360 
361 #endif
Base class for all exceptions used in the auger offline code.
Base class for exceptions arising because configuration data are not valid.
DataNotFoundInDBException(const std::string &table, const std::string &column, const std::map< std::string, std::string > &indexMap, const std::string &time)
Base class for exceptions trying to access non-existing components.
Exception to use in case of module sequencing failures.
Exception for errors encountered when parsing XML.
Exception to use in a atmosphere model cannot find data it needs.
Exception for reporting variable out of valid range.
Base class to report exceptions in IO.
Exception to use if sequence of initialisations violated.
Exception to use in case requested data not found in the database with detailed printout.
std::map< std::string, std::string > fIndexMap
std::string fMessage
Base class for inconsistency/illogicality exceptions.
Exception for errors encountered when validating XML files.
Base class for exceptions arising because required info not present in the Event. ...
Exception for invalid operation on Iterators.
const std::string & GetMessage() const
Retrieve the message from the exception.
const char * what() const
std::exception will print this on crash

, generated on Tue Sep 26 2023.