CLHEP VERSION Reference Documentation
CLHEP Home Page
CLHEP Documentation
CLHEP Bug Reports
Exceptions
test
exctest1.cc
Go to the documentation of this file.
1
#include <iostream>
2
using
std::cerr;
3
using
std::endl;
4
5
6
#include "
CLHEP/Exceptions/ZMexception.h
"
7
#include "
CLHEP/Exceptions/ZMthrow.h
"
8
using namespace
zmex
;
9
10
11
ZMexStandardDefinition
(
ZMexception
,
Oops
);
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()
ZMthrow
#define ZMthrow(userExcept)
Definition:
CLHEP/Exceptions/ZMthrow.h:97
zmex
Definition:
CLHEP/Exceptions/ZMerrno.h:52
ZMthrow.h
zmex::ZMexception
Definition:
CLHEP/Exceptions/ZMexception.h:163
zmex::ZMexClassInfo
Definition:
CLHEP/Exceptions/ZMexClassInfo.h:94
Oops
Definition:
exctest2.cc:14
main
int main()
Definition:
exctest1.cc:15
ZMexStandardDefinition
ZMexStandardDefinition(ZMexception, Oops)
ZMexception.h
zmex::ZMexERROR
@ ZMexERROR
Definition:
CLHEP/Exceptions/ZMexSeverity.h:46
Generated by
1.8.17