CMS 3D CMS Logo

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