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

exctest4.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", "exctest4", ZMexERROR
00013                               , ZMexHandler( ZMexThrowAlways() )
00014                               , ZMexLogger ( ZMexLogNever() )
00015                               );
00016 
00017 
00018 int main()  {
00019 
00020   cerr << "Starting main() ..." << endl;
00021 
00022 #ifndef DEFECT_NO_EXCEPTIONS
00023   try  {
00024 #endif
00025     //cerr << "About to:  Oops::setHandler( ZMexHandler( ZMexIgnoreAlways() ) );
00026     //Oops::setHandler( ZMexHandler( ZMexIgnoreAlways() ) );
00027 
00028     cerr << "About to:  ZMthrow( Oops(\"Ouch\") )" << endl;
00029     ZMthrow( Oops("Ouch") );
00030     // unreachable statement:
00031     cerr << "Got past:  ZMthrow( Oops(\"Ouch\") ) -- not good!" << endl;
00032 #ifndef DEFECT_NO_EXCEPTIONS
00033   }
00034   catch ( const Oops egad )  {
00035     cerr << "Caught:  Oops" << endl;
00036   }
00037   catch ( const ZMexception egad )  {
00038     cerr << "Caught:  ZMexception" << endl;
00039   }
00040   catch ( ... )  {
00041     cerr << "Caught:  don't know what" << endl;
00042   }
00043 #endif
00044 
00045   cerr << "Done." << endl;
00046   return 0;
00047 
00048 }  // main()

Generated on 15 Nov 2012 for CLHEP by  doxygen 1.4.7