MCPcopy Create free account
hub / github.com/Geant4/geant4 / Notify

Method Notify

source/run/src/G4ExceptionHandler.cc:74–138  ·  view source on GitHub ↗

--------------------------------------------------------------------

Source from the content-addressed store, hash-verified

72
73// --------------------------------------------------------------------
74G4bool G4ExceptionHandler::Notify(const char* originOfException, const char* exceptionCode,
75 G4ExceptionSeverity severity, const char* description)
76{
77 static const G4String es_banner =
78 "\n-------- EEEE ------- G4Exception-START -------- EEEE -------\n";
79 static const G4String ee_banner =
80 "\n-------- EEEE -------- G4Exception-END --------- EEEE -------\n";
81 static const G4String ws_banner =
82 "\n-------- WWWW ------- G4Exception-START -------- WWWW -------\n";
83 static const G4String we_banner =
84 "\n-------- WWWW -------- G4Exception-END --------- WWWW -------\n";
85 std::ostringstream message;
86 message << "*** G4Exception : " << exceptionCode << G4endl
87 << " issued by : " << originOfException << G4endl << description << G4endl;
88 G4bool abortionForCoreDump = false;
89 G4ApplicationState aps = G4StateManager::GetStateManager()->GetCurrentState();
90 switch (severity) {
91 case FatalException:
92 G4cerr << es_banner << message.str() << "*** Fatal Exception *** core dump ***" << G4endl;
93 DumpTrackInfo();
94 G4cerr << ee_banner << G4endl;
95 abortionForCoreDump = true;
96 break;
97 case FatalErrorInArgument:
98 G4cerr << es_banner << message.str() << "*** Fatal Error In Argument *** core dump ***"
99 << G4endl;
100 DumpTrackInfo();
101 G4cerr << ee_banner << G4endl;
102 abortionForCoreDump = true;
103 break;
104 case RunMustBeAborted:
105 if (aps == G4State_GeomClosed || aps == G4State_EventProc) {
106 G4cerr << es_banner << message.str() << "*** Run Must Be Aborted ***" << G4endl;
107 DumpTrackInfo();
108 G4cerr << ee_banner << G4endl;
109 G4RunManager::GetRunManager()->AbortRun(false);
110 }
111 abortionForCoreDump = false;
112 break;
113 case EventMustBeAborted:
114 if (aps == G4State_EventProc) {
115 G4cerr << es_banner << message.str() << "*** Event Must Be Aborted ***" << G4endl;
116 DumpTrackInfo();
117 G4cerr << ee_banner << G4endl;
118 G4RunManager::GetRunManager()->AbortEvent();
119 }
120 abortionForCoreDump = false;
121 break;
122 case JustWarning:
123 if(IfPrint(exceptionCode))
124 {
125 std::ostringstream wmessage;
126 wmessage << "*** G4Exception : " << exceptionCode << G4endl
127 << " issued by : " << originOfException << G4endl << description << G4endl;
128 G4cout << ws_banner << wmessage.str() << "*** This is just a warning message. ***" << we_banner
129 << G4endl;
130 }
131 abortionForCoreDump = false;

Callers

nothing calls this directly

Calls 2

AbortRunMethod · 0.45
AbortEventMethod · 0.45

Tested by

no test coverage detected