|
Celeritas 0.7.0-dev.313+develop.1857205b
|
Convert Geant4 exceptions to RuntimeError during this class lifetime. More...
#include <ScopedGeantExceptionHandler.hh>
Public Types | |
Type aliases | |
| using | StdExceptionHandler = std::function< void(std::exception_ptr)> |
Public Member Functions | |
| ScopedGeantExceptionHandler () | |
| Construct, throwing on G4Exception calls. | |
| ScopedGeantExceptionHandler (ScopedGeantExceptionHandler const &)=delete | |
| Prevent copying and moving for RAII class. | |
| ScopedGeantExceptionHandler & | operator= (ScopedGeantExceptionHandler const &)=delete |
| ScopedGeantExceptionHandler (ScopedGeantExceptionHandler &&)=delete | |
| ScopedGeantExceptionHandler & | operator= (ScopedGeantExceptionHandler &&)=delete |
| ScopedGeantExceptionHandler (StdExceptionHandler handle) | |
| Install the Celeritas Geant4 exception handler. | |
Convert Geant4 exceptions to RuntimeError during this class lifetime.
Because the underlying Geant4 error handler is thread-local, this class must be scoped to inside each worker thread. Additionally, since throwing from a worker thread terminates the program, an error handler must be specified if used in a worker thread: you should probably use a celeritas::MultiExceptionHandler if used inside a worker thread.
G4RunManagerKernel resets the exception handler, so errors thrown during setup cannot be caught by Celeritas, and this class can only be used after creating the G4RunManager.
|
inlineexplicit |
Install the Celeritas Geant4 exception handler.
The base class of the exception handler calls SetExceptionHandler...
Do nothing if Geant4 is disabled (source file will not be compiled)