File: exctest1.cc

package info (click to toggle)
clhep 2.1.4.1%2Bdfsg-1.1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 10,012 kB
  • sloc: cpp: 50,094; sh: 6,694; makefile: 2,694; perl: 28
file content (45 lines) | stat: -rwxr-xr-x 1,029 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#include <iostream>
using std::cerr;
using std::endl;


#include "CLHEP/Exceptions/ZMexception.h"
#include "CLHEP/Exceptions/ZMthrow.h"
using namespace zmex;


ZMexStandardDefinition(ZMexception,Oops);
ZMexClassInfo Oops::_classInfo( "Oops", "exctest1", ZMexERROR );


int main()  {

  cerr << "Starting main() ..." << endl;

#ifndef DEFECT_NO_EXCEPTIONS
  try  {
#endif
    //cerr << "About to:  Oops::setHandler( ZMexHandler( ZMexIgnoreAlways() ) );
    //Oops::setHandler( ZMexHandler( ZMexIgnoreAlways() ) );

    cerr << "About to:  ZMthrow( Oops(\"Ouch\") )" << endl;
    ZMthrow( Oops("Ouch") );
    // unreachable statement:
    cerr << "Got past:  ZMthrow( Oops(\"Ouch\") ) -- not good!" << endl;
#ifndef DEFECT_NO_EXCEPTIONS
  }
  catch ( const Oops egad )  {
    cerr << "Caught:  Oops" << endl;
  }
  catch ( const ZMexception egad )  {
    cerr << "Caught:  ZMexception" << endl;
  }
  catch ( ... )  {
    cerr << "Caught:  don't know what" << endl;
  }
#endif

  cerr << "Done." << endl;
  return 0;

}  // main()