[828] | 1 | // |
---|
| 2 | // ******************************************************************** |
---|
| 3 | // * License and Disclaimer * |
---|
| 4 | // * * |
---|
| 5 | // * The Geant4 software is copyright of the Copyright Holders of * |
---|
| 6 | // * the Geant4 Collaboration. It is provided under the terms and * |
---|
| 7 | // * conditions of the Geant4 Software License, included in the file * |
---|
| 8 | // * LICENSE and available at http://cern.ch/geant4/license . These * |
---|
| 9 | // * include a list of copyright holders. * |
---|
| 10 | // * * |
---|
| 11 | // * Neither the authors of this software system, nor their employing * |
---|
| 12 | // * institutes,nor the agencies providing financial support for this * |
---|
| 13 | // * work make any representation or warranty, express or implied, * |
---|
| 14 | // * regarding this software system or assume any liability for its * |
---|
| 15 | // * use. Please see the license in the file LICENSE and URL above * |
---|
| 16 | // * for the full disclaimer and the limitation of liability. * |
---|
| 17 | // * * |
---|
| 18 | // * This code implementation is the result of the scientific and * |
---|
| 19 | // * technical work of the GEANT4 collaboration. * |
---|
| 20 | // * By using, copying, modifying or distributing the software (or * |
---|
| 21 | // * any work based on the software) you agree to acknowledge its * |
---|
| 22 | // * use in resulting scientific publications, and indicate your * |
---|
| 23 | // * acceptance of all terms of the Geant4 Software license. * |
---|
| 24 | // ******************************************************************** |
---|
| 25 | // |
---|
| 26 | // |
---|
| 27 | // $Id: G4ExceptionHandler.cc,v 1.4 2006/06/29 21:13:40 gunter Exp $ |
---|
[850] | 28 | // GEANT4 tag $Name: HEAD $ |
---|
[828] | 29 | // |
---|
| 30 | // |
---|
| 31 | // ------------------------------------------------------------ |
---|
| 32 | // GEANT 4 class implementation file |
---|
| 33 | // |
---|
| 34 | // ---------------- G4ExceptionHandler ---------------- |
---|
| 35 | // by Makoto Asai (August 2002) |
---|
| 36 | // ------------------------------------------------------------ |
---|
| 37 | |
---|
| 38 | #include "G4ExceptionHandler.hh" |
---|
| 39 | #include "G4StateManager.hh" |
---|
| 40 | #include "G4RunManager.hh" |
---|
| 41 | #include "G4ios.hh" |
---|
| 42 | #include <stdlib.h> |
---|
| 43 | #include "G4String.hh" |
---|
| 44 | |
---|
| 45 | G4ExceptionHandler::G4ExceptionHandler() |
---|
| 46 | { |
---|
| 47 | } |
---|
| 48 | |
---|
| 49 | G4ExceptionHandler::~G4ExceptionHandler() |
---|
| 50 | { |
---|
| 51 | } |
---|
| 52 | |
---|
| 53 | G4ExceptionHandler::G4ExceptionHandler(const G4ExceptionHandler &) |
---|
| 54 | :G4VExceptionHandler() |
---|
| 55 | { |
---|
| 56 | } |
---|
| 57 | |
---|
| 58 | G4ExceptionHandler& G4ExceptionHandler::operator=(const G4ExceptionHandler &) |
---|
| 59 | { |
---|
| 60 | return *this; |
---|
| 61 | } |
---|
| 62 | |
---|
| 63 | G4int G4ExceptionHandler::operator==(const G4ExceptionHandler &right) const |
---|
| 64 | { |
---|
| 65 | return (this == &right); |
---|
| 66 | } |
---|
| 67 | |
---|
| 68 | G4int G4ExceptionHandler::operator!=(const G4ExceptionHandler &right) const |
---|
| 69 | { |
---|
| 70 | return (this != &right); |
---|
| 71 | } |
---|
| 72 | |
---|
| 73 | G4bool G4ExceptionHandler::Notify(const char* originOfException, |
---|
| 74 | const char* exceptionCode, |
---|
| 75 | G4ExceptionSeverity severity, |
---|
| 76 | const char* description) |
---|
| 77 | { |
---|
| 78 | G4cerr << G4endl; |
---|
| 79 | G4cerr << "*** G4Exception : " << exceptionCode << G4endl; |
---|
| 80 | G4cerr << " issued by : " << originOfException << G4endl; |
---|
| 81 | G4cerr << description << G4endl; |
---|
| 82 | G4bool abortionForCoreDump = false; |
---|
| 83 | G4ApplicationState aps = G4StateManager::GetStateManager()->GetCurrentState(); |
---|
| 84 | switch(severity) |
---|
| 85 | { |
---|
| 86 | case FatalException: |
---|
| 87 | G4cerr << "*** Fatal Exception *** core dump ***"; |
---|
| 88 | abortionForCoreDump = true; |
---|
| 89 | break; |
---|
| 90 | case FatalErrorInArgument: |
---|
| 91 | G4cerr << "*** Fatal Error In Argument *** core dump ***"; |
---|
| 92 | abortionForCoreDump = true; |
---|
| 93 | break; |
---|
| 94 | case RunMustBeAborted: |
---|
| 95 | if(aps==G4State_GeomClosed || aps==G4State_EventProc) |
---|
| 96 | { |
---|
| 97 | G4cerr << "*** Run Must Be Aborted "; |
---|
| 98 | G4RunManager::GetRunManager()->AbortRun(false); |
---|
| 99 | } |
---|
| 100 | abortionForCoreDump = false; |
---|
| 101 | break; |
---|
| 102 | case EventMustBeAborted: |
---|
| 103 | if(aps==G4State_EventProc) |
---|
| 104 | { |
---|
| 105 | G4cerr << "*** Event Must Be Aborted "; |
---|
| 106 | G4RunManager::GetRunManager()->AbortEvent(); |
---|
| 107 | } |
---|
| 108 | abortionForCoreDump = false; |
---|
| 109 | break; |
---|
| 110 | default: |
---|
| 111 | G4cerr << "*** This is just a warning message."; |
---|
| 112 | abortionForCoreDump = false; |
---|
| 113 | break; |
---|
| 114 | } |
---|
| 115 | G4cerr << G4endl; |
---|
| 116 | return abortionForCoreDump; |
---|
| 117 | } |
---|
| 118 | |
---|
| 119 | |
---|