testCatchWrongType.cc
Go to the documentation of this file.
1 /*
2  Test auger excpetion hierarchy
3 */
4 
5 #include <iostream>
6 #include <utl/AugerException.h>
7 
8 using namespace std;
9 using namespace utl;
10 
12 {
13  throw AugerException("Throwing in throwGeneric.");
14  return;
15 }
16 
18 {
19  throw NonExistentComponentException("Throwing in throwNonExistent.");
20  return;
21 }
22 
23 int main()
24 {
25  cerr << "==> Trying to catch generic exception with sub-class exception"
26  << endl;
27  try {
28  throwGeneric();
29  }
30  catch (NonExistentComponentException& ex) {
31  cerr << "Non-existent component exception: "
32  << ex.GetExceptionName() << endl;
33  cerr << "Message: " << ex.GetMessage() << endl;
34  }
35 
36  return 0;
37 }
38 
39 // Configure (x)emacs for this file ...
40 // Local Variables:
41 // mode:c++
42 // compile-command: "cd ..; make -k check"
43 // End:
Base class for all exceptions used in the auger offline code.
Base class for exceptions trying to access non-existing components.
int main(int argc, char *argv[])
Definition: DBSync.cc:58
void throwGeneric()
const std::string & GetMessage() const
Retrieve the message from the exception.
void throwNonExistent()

, generated on Tue Sep 26 2023.