CLHEP 2.0.4.7 Reference Documentation
   
CLHEP Home Page     CLHEP Documentation     CLHEP Bug Reports

exctest1.cc

Go to the documentation of this file.
00001 #include <iostream>
00002 using std::cerr;
00003 using std::endl;
00004 
00005 
00006 #include "CLHEP/Exceptions/ZMexception.h"
00007 #include "CLHEP/Exceptions/ZMthrow.h"
00008 using namespace zmex;
00009 
00010 
00011 ZMexStandardDefinition(ZMexception,Oops);
00012 ZMexClassInfo Oops::_classInfo( "Oops", "exctest1", ZMexERROR );
00013 
00014 
00015 int main()  {
00016 
00017   cerr << "Starting main() ..." << endl;
00018 
00019 #ifndef DEFECT_NO_EXCEPTIONS
00020   try  {
00021 #endif
00022     //cerr << "About to:  Oops::setHandler( ZMexHandler( ZMexIgnoreAlways() ) );
00023     //Oops::setHandler( ZMexHandler( ZMexIgnoreAlways() ) );
00024 
00025     cerr << "About to:  ZMthrow( Oops(\"Ouch\") )" << endl;
00026     ZMthrow( Oops("Ouch") );
00027     // unreachable statement:
00028     cerr << "Got past:  ZMthrow( Oops(\"Ouch\") ) -- not good!" << endl;
00029 #ifndef DEFECT_NO_EXCEPTIONS
00030   }
00031   catch ( const Oops egad )  {
00032     cerr << "Caught:  Oops" << endl;
00033   }
00034   catch ( const ZMexception egad )  {
00035     cerr << "Caught:  ZMexception" << endl;
00036   }
00037   catch ( ... )  {
00038     cerr << "Caught:  don't know what" << endl;
00039   }
00040 #endif
00041 
00042   cerr << "Done." << endl;
00043   return 0;
00044 
00045 }  // main()

Generated on Thu Jul 1 22:02:30 2010 for CLHEP by  doxygen 1.4.7