G4Exception.cc File Reference

#include "G4ios.hh"
#include "G4String.hh"
#include "G4StateManager.hh"

Go to the source code of this file.

Functions

void G4Exception (const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
void G4Exception (const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, G4ExceptionDescription &description)
void G4Exception (const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, G4ExceptionDescription &description, const char *comments)


Function Documentation

void G4Exception ( const char *  originOfException,
const char *  exceptionCode,
G4ExceptionSeverity  severity,
G4ExceptionDescription description,
const char *  comments 
)

Definition at line 119 of file G4Exception.cc.

References G4endl, and G4Exception().

00124 {
00125   description << comments << G4endl;
00126   G4Exception(originOfException, exceptionCode, severity, description);
00127 }

void G4Exception ( const char *  originOfException,
const char *  exceptionCode,
G4ExceptionSeverity  severity,
G4ExceptionDescription description 
)

Definition at line 110 of file G4Exception.cc.

References G4Exception().

00114 {
00115   G4String des = description.str();
00116   G4Exception(originOfException, exceptionCode, severity, des.c_str());
00117 }

void G4Exception ( const char *  originOfException,
const char *  exceptionCode,
G4ExceptionSeverity  severity,
const char *  description 
)

Definition at line 41 of file G4Exception.cc.

00045 {
00046   G4VExceptionHandler* exceptionHandler
00047     = G4StateManager::GetStateManager()->GetExceptionHandler();
00048   G4bool toBeAborted = true;
00049   if(exceptionHandler)
00050   {
00051     toBeAborted = exceptionHandler
00052      ->Notify(originOfException,exceptionCode,severity,description);
00053   }
00054   else
00055   {
00056     static const G4String es_banner
00057       = "\n-------- EEEE ------- G4Exception-START -------- EEEE -------\n";
00058     static const G4String ee_banner
00059       = "\n-------- EEEE -------- G4Exception-END --------- EEEE -------\n";
00060     static const G4String ws_banner
00061       = "\n-------- WWWW ------- G4Exception-START -------- WWWW -------\n";
00062     static const G4String we_banner
00063       = "\n-------- WWWW -------- G4Exception-END --------- WWWW -------\n";
00064     std::ostringstream message;
00065     message << "\n*** ExceptionHandler is not defined ***\n"
00066             << "*** G4Exception : " << exceptionCode << G4endl
00067             << "      issued by : " << originOfException << G4endl
00068             << description << G4endl;
00069     switch(severity)
00070     {
00071      case FatalException:
00072       G4cerr << es_banner << message.str() << "*** Fatal Exception ***"
00073              << ee_banner << G4endl;
00074       break;
00075      case FatalErrorInArgument:
00076       G4cerr << es_banner << message.str() << "*** Fatal Error In Argument ***"
00077              << ee_banner << G4endl;
00078       break;
00079      case RunMustBeAborted:
00080       G4cerr << es_banner << message.str() << "*** Run Must Be Aborted ***"
00081              << ee_banner << G4endl;
00082       break;
00083      case EventMustBeAborted:
00084       G4cerr << es_banner << message.str() << "*** Event Must Be Aborted ***"
00085              << ee_banner << G4endl;
00086       break;
00087      default:
00088       G4cout << ws_banner << message.str()
00089              << "*** This is just a warning message. ***"
00090              << we_banner << G4endl;
00091       toBeAborted = false;
00092       break;
00093     }
00094   }
00095   if(toBeAborted)
00096   {
00097    if(G4StateManager::GetStateManager()->SetNewState(G4State_Abort))
00098    {
00099      G4cerr << G4endl << "*** G4Exception: Aborting execution ***" << G4endl;
00100      abort();
00101    }
00102    else
00103    {
00104      G4cerr << G4endl << "*** G4Exception: Abortion suppressed ***"
00105             << G4endl << "*** No guarantee for further execution ***" << G4endl;
00106    }
00107   }
00108 }


Generated on Mon May 27 17:50:43 2013 for Geant4 by  doxygen 1.4.7