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

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