Loading src/tools/geant4/G4ExceptionHandler.hpp +11 −2 Original line number Diff line number Diff line Loading @@ -13,6 +13,7 @@ #define ALLPIX_GEANT4_EXCEPTIONS_H #include "core/module/exceptions.h" #include "core/utils/log.h" #include <G4VExceptionHandler.hh> Loading @@ -27,8 +28,16 @@ namespace allpix { */ class G4ExceptionHandler : public G4VExceptionHandler { public: G4bool Notify(const char*, const char* exceptionCode, G4ExceptionSeverity, const char* description) override { throw ModuleError("Caught Geant4 exception " + std::string(exceptionCode) + ": " + std::string(description)); G4bool Notify(const char*, const char* code, G4ExceptionSeverity severity, const char* description) override { std::string message = "Caught Geant4 exception " + std::string(code) + ": " + std::string(description); if(severity == G4ExceptionSeverity::JustWarning) { LOG(WARNING) << message; } else { throw ModuleError(message); } // Continue program execution: return false; }; }; Loading Loading
src/tools/geant4/G4ExceptionHandler.hpp +11 −2 Original line number Diff line number Diff line Loading @@ -13,6 +13,7 @@ #define ALLPIX_GEANT4_EXCEPTIONS_H #include "core/module/exceptions.h" #include "core/utils/log.h" #include <G4VExceptionHandler.hh> Loading @@ -27,8 +28,16 @@ namespace allpix { */ class G4ExceptionHandler : public G4VExceptionHandler { public: G4bool Notify(const char*, const char* exceptionCode, G4ExceptionSeverity, const char* description) override { throw ModuleError("Caught Geant4 exception " + std::string(exceptionCode) + ": " + std::string(description)); G4bool Notify(const char*, const char* code, G4ExceptionSeverity severity, const char* description) override { std::string message = "Caught Geant4 exception " + std::string(code) + ": " + std::string(description); if(severity == G4ExceptionSeverity::JustWarning) { LOG(WARNING) << message; } else { throw ModuleError(message); } // Continue program execution: return false; }; }; Loading