Functions
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,
const char *  description 
)

Definition at line 45 of file G4Exception.cc.

49 {
50  std::string exceptCodeStr(exceptionCode);
51 // bool skipPrintIt = exceptCodeStr.find("GeomNav") != std::string::npos;
52  bool skipPrintIt = exceptCodeStr.find("GeomNav") != std::string::npos;
53  if (severity == JustWarning && skipPrintIt) return;
54  G4VExceptionHandler* exceptionHandler
55  = G4StateManager::GetStateManager()->GetExceptionHandler();
56  G4bool toBeAborted = true;
57  if(exceptionHandler)
58  {
59  toBeAborted = exceptionHandler
60  ->Notify(originOfException,exceptionCode,severity,description);
61  }
62  else
63  {
64  static const G4String es_banner
65  = "\n-------- EEEE ------- G4Exception-START -------- EEEE -------\n";
66  static const G4String ee_banner
67  = "\n-------- EEEE -------- G4Exception-END --------- EEEE -------\n";
68  static const G4String ws_banner
69  = "\n-------- WWWW ------- G4Exception-START -------- WWWW -------\n";
70  static const G4String we_banner
71  = "\n-------- WWWW -------- G4Exception-END --------- WWWW -------\n";
72  std::ostringstream message;
73  message << "\n*** ExceptionHandler is not defined ***\n"
74  << "*** G4Exception : " << exceptionCode << G4endl
75  << " issued by : " << originOfException << G4endl
76  << description << G4endl;
77  switch(severity)
78  {
79  case FatalException:
80  G4cerr << es_banner << message.str() << "*** Fatal Exception ***"
81  << ee_banner << G4endl;
82  break;
83  case FatalErrorInArgument:
84  G4cerr << es_banner << message.str() << "*** Fatal Error In Argument ***"
85  << ee_banner << G4endl;
86  break;
87  case RunMustBeAborted:
88  G4cerr << es_banner << message.str() << "*** Run Must Be Aborted ***"
89  << ee_banner << G4endl;
90  break;
91  case EventMustBeAborted:
92  G4cerr << es_banner << message.str() << "*** Event Must Be Aborted ***"
93  << ee_banner << G4endl;
94  break;
95  default:
96  G4cout << ws_banner << message.str()
97  << "*** This is just a warning message. ***"
98  << we_banner << G4endl;
99  toBeAborted = false;
100  break;
101  }
102  }
103  if(toBeAborted)
104  {
105  if(G4StateManager::GetStateManager()->SetNewState(G4State_Abort))
106  {
107  G4cerr << G4endl << "*** G4Exception: Aborting execution ***" << G4endl;
108  abort();
109  }
110  else
111  {
112  G4cerr << G4endl << "*** G4Exception: Abortion suppressed ***"
113  << G4endl << "*** No guarantee for further execution ***" << G4endl;
114  }
115  }
116 }
std::string string
Definition: nybbler.cc:12
void G4Exception ( const char *  originOfException,
const char *  exceptionCode,
G4ExceptionSeverity  severity,
G4ExceptionDescription &  description 
)

Definition at line 118 of file G4Exception.cc.

122 {
123  G4String des = description.str();
124  G4Exception(originOfException, exceptionCode, severity, des.c_str());
125 }
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
Definition: G4Exception.cc:45
void G4Exception ( const char *  originOfException,
const char *  exceptionCode,
G4ExceptionSeverity  severity,
G4ExceptionDescription &  description,
const char *  comments 
)

Definition at line 127 of file G4Exception.cc.

132 {
133  description << comments << G4endl;
134  G4Exception(originOfException, exceptionCode, severity, description);
135 }
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
Definition: G4Exception.cc:45
static QList< CommentInPrepass > comments