LArSoft  v06_85_00
Liquid Argon Software toolkit - http://larsoft.org/
PyG4ExceptionHandler Class Reference
Inheritance diagram for PyG4ExceptionHandler:

Public Member Functions

 PyG4ExceptionHandler ()
 
 ~PyG4ExceptionHandler ()
 
G4bool Notify (const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
 

Detailed Description

Definition at line 42 of file pyG4ExceptionHandler.cc.

Constructor & Destructor Documentation

PyG4ExceptionHandler::PyG4ExceptionHandler ( )
inline

Definition at line 44 of file pyG4ExceptionHandler.cc.

44  :G4VExceptionHandler() {
45  G4StateManager* sm= G4StateManager::GetStateManager();
46  sm-> SetExceptionHandler(this);
47  }
PyG4ExceptionHandler::~PyG4ExceptionHandler ( )
inline

Definition at line 48 of file pyG4ExceptionHandler.cc.

48 { }

Member Function Documentation

G4bool PyG4ExceptionHandler::Notify ( const char *  originOfException,
const char *  exceptionCode,
G4ExceptionSeverity  severity,
const char *  description 
)
inline

Definition at line 50 of file pyG4ExceptionHandler.cc.

53  {
54 
55  std::ostringstream message;
56  message << "*** G4Exception : " << exceptionCode << G4endl
57  << " issued by : " << originOfException << G4endl
58  << description << G4endl;
59 
60  switch(severity) {
61  case FatalException:
62  PyErr_SetString(PyExc_AssertionError,
63  "*** Fatal Exception ***");
64  PyErr_Print();
65  G4cerr << message.str() << G4endl;
66  break;
67 
68  case FatalErrorInArgument:
69  PyErr_SetString(PyExc_ValueError,
70  "*** Fatal Error In Argument ***");
71  PyErr_Print();
72  G4cerr << message.str() << G4endl;
73  break;
74 
75  case RunMustBeAborted:
76  PyErr_SetString(PyExc_RuntimeError,
77  "*** Run Must Be Aborted ***");
78  PyErr_Print();
79  G4cerr << message.str() << G4endl;
80  break;
81 
82  case EventMustBeAborted:
83  PyErr_SetString(PyExc_RuntimeError,
84  "*** Event Must Be Aborted ***");
85  PyErr_Print();
86  G4cerr << message.str() << G4endl;
87  break;
88 
89  default:
90  PyErr_Warn(PyExc_RuntimeWarning,
91  "*** This is just a warning message. ***");
92  G4cerr << message.str() << G4endl;
93  break;
94  }
95 
96  // anyway, no abort.
97  return false;
98  }

The documentation for this class was generated from the following file: