CMS 3D CMS Logo

ExceptionHandler.cc
Go to the documentation of this file.
3 
5 
6 #include "globals.hh"
7 #include <sstream>
8 
10 {}
11 
13 {}
14 
15 bool ExceptionHandler::Notify(const char* exceptionOrigin,
16  const char* exceptionCode,
17  G4ExceptionSeverity severity,
18  const char* description)
19 {
20  static const G4String es_banner
21  = "\n-------- EEEE ------- G4Exception-START -------- EEEE -------\n";
22  static const G4String ee_banner
23  = "\n-------- EEEE -------- G4Exception-END --------- EEEE -------\n";
24  static const G4String ws_banner
25  = "\n-------- WWWW ------- G4Exception-START -------- WWWW -------\n";
26  static const G4String we_banner
27  = "\n-------- WWWW -------- G4Exception-END --------- WWWW -------\n";
28 
29  std::stringstream message;
30  message << "*** G4Exception : " << exceptionCode << "\n"
31  << " issued by : " << exceptionOrigin << "\n"
32  << description;
33 
34  std::stringstream ss;
35  switch(severity) {
36 
37  case FatalException:
38  case FatalErrorInArgument:
39  case RunMustBeAborted:
40  case EventMustBeAborted:
41  ss << es_banner << message.str() << ee_banner;
42  throw SimG4Exception(ss.str());
43  break;
44 
45  case JustWarning:
46  edm::LogWarning("SimG4CoreApplication")
47  << ws_banner << message.str() << "*** This is just a warning message. ***"
48  << we_banner;
49  break;
50  }
51  return false;
52 }
53 
~ExceptionHandler() override
bool Notify(const char *exceptionOrigin, const char *exceptionCode, G4ExceptionSeverity severity, const char *description) override