CLHEP VERSION Reference Documentation
   
CLHEP Home Page     CLHEP Documentation     CLHEP Bug Reports

exctest1.cc
Go to the documentation of this file.
1 #include <iostream>
2 using std::cerr;
3 using std::endl;
4 
5 
8 using namespace zmex;
9 
10 
12 ZMexClassInfo Oops::_classInfo( "Oops", "exctest1", ZMexERROR );
13 
14 
15 int main() {
16 
17  cerr << "Starting main() ..." << endl;
18 
19 #ifndef DEFECT_NO_EXCEPTIONS
20  try {
21 #endif
22  //cerr << "About to: Oops::setHandler( ZMexHandler( ZMexIgnoreAlways() ) );
23  //Oops::setHandler( ZMexHandler( ZMexIgnoreAlways() ) );
24 
25  cerr << "About to: ZMthrow( Oops(\"Ouch\") )" << endl;
26  ZMthrow( Oops("Ouch") );
27  // unreachable statement:
28  cerr << "Got past: ZMthrow( Oops(\"Ouch\") ) -- not good!" << endl;
29 #ifndef DEFECT_NO_EXCEPTIONS
30  }
31  catch ( const Oops egad ) {
32  cerr << "Caught: Oops" << endl;
33  }
34  catch ( const ZMexception egad ) {
35  cerr << "Caught: ZMexception" << endl;
36  }
37  catch ( ... ) {
38  cerr << "Caught: don't know what" << endl;
39  }
40 #endif
41 
42  cerr << "Done." << endl;
43  return 0;
44 
45 } // main()
#define ZMthrow(userExcept)
Definition: exctest2.cc:14
ZMexStandardDefinition(ZMexception, Oops)
int main()
Definition: exctest1.cc:15