CLHEP 2.4.6.4
C++ Class Library for High Energy Physics
Loading...
Searching...
No Matches
exctest4.cc
Go to the documentation of this file.
1#include <iostream>
2using std::cerr;
3using std::endl;
4
5
6#include "CLHEP/Exceptions/ZMexception.h"
7#include "CLHEP/Exceptions/ZMexAction.h"
8#include "CLHEP/Exceptions/ZMexClassInfo.h"
9#include "CLHEP/Exceptions/ZMexSeverity.h"
10#include "CLHEP/Exceptions/ZMthrow.h"
11using namespace zmex;
12
13
15ZMexClassInfo Oops::_classInfo( "Oops", "exctest4", ZMexERROR
18 );
19
20
21int main() {
22
23 cerr << "Starting main() ..." << endl;
24
25#ifndef DEFECT_NO_EXCEPTIONS
26 try {
27#endif
28 //cerr << "About to: Oops::setHandler( ZMexHandler( ZMexIgnoreAlways() ) );
29 //Oops::setHandler( ZMexHandler( ZMexIgnoreAlways() ) );
30
31 cerr << "About to: ZMthrow( Oops(\"Ouch\") )" << endl;
32 ZMthrow( Oops("Ouch") );
33 // unreachable statement:
34 cerr << "Got past: ZMthrow( Oops(\"Ouch\") ) -- not good!" << endl;
35#ifndef DEFECT_NO_EXCEPTIONS
36 }
37 catch ( const Oops &egad ) {
38 cerr << "Caught: Oops" << endl;
39 }
40 catch ( const ZMexception &egad ) {
41 cerr << "Caught: ZMexception" << endl;
42 }
43 catch ( ... ) {
44 cerr << "Caught: don't know what" << endl;
45 }
46#endif
47
48 cerr << "Done." << endl;
49 return 0;
50
51} // main()
#define ZMexStandardDefinition(Parent, Class)
Definition: ZMexception.h:523
#define ZMthrow(userExcept)
Definition: ZMthrow.h:97
Definition: exctest2.cc:14
int main()
Definition: exctest4.cc:21
Definition: ZMerrno.h:52
@ ZMexERROR
Definition: ZMexSeverity.h:46