The Gaudi Framework  master (37c0b60a)
Guards.cpp
Go to the documentation of this file.
1 /***********************************************************************************\
2 * (c) Copyright 1998-2024 CERN for the benefit of the LHCb and ATLAS collaborations *
3 * *
4 * This software is distributed under the terms of the Apache version 2 licence, *
5 * copied verbatim in the file "LICENSE". *
6 * *
7 * In applying this licence, CERN does not waive the privileges and immunities *
8 * granted to it by virtue of its status as an Intergovernmental Organization *
9 * or submit itself to any jurisdiction. *
10 \***********************************************************************************/
11 // ============================================================================
12 // Include files
13 // ============================================================================
14 // STD & STL
15 // ============================================================================
16 #include <exception>
17 // ============================================================================
18 // GaudiKernel
19 // ============================================================================
21 #include <GaudiKernel/Guards.h>
22 #include <GaudiKernel/MsgStream.h>
23 #include <GaudiKernel/System.h>
24 // ============================================================================
31 // ============================================================================
32 // Local handle (print) of GaudiException
33 // ============================================================================
35  // the general printout
36  log << MSG::FATAL << System::typeinfoName( typeid( exc ) ) << "('" << exc.tag() << "') is caught!" << endmsg;
37  // print the detailes about the exception:
38  log << MSG::ERROR << exc << endmsg;
39  // get the status code form the exception:
40  m_sc = exc.code();
41 }
42 // ============================================================================
43 // Local handle (print) of std::exception
44 // ============================================================================
46  // the general printout
47  log << MSG::FATAL << System::typeinfoName( typeid( exc ) ) << " is caught!" << endmsg;
48  // print the detailes abotu the exception:
49  log << MSG::ERROR << exc.what() << endmsg;
50 }
51 // ============================================================================
52 // Local handle (print) of unknown exception
53 // ============================================================================
55  // the general printout
56  log << MSG::FATAL << "UNKNOWN exception is caught!" << endmsg;
57 }
58 // ============================================================================
59 // dectructor
60 // ============================================================================
62 // ============================================================================
63 // constructor with standard post-action
64 // ============================================================================
66  : m_obj( obj ), m_svc( svc ), m_evt( evt ) {
67  i_before();
68 }
70  : m_obj( obj )
71  , m_svc( svc )
72  , m_evt( IAuditor::Initialize )
73  , // Windows needs an explicit value
74  m_cevt( std::move( evt ) )
75  , m_customEvtType( true ) {
76  i_before();
77 }
79  const StatusCode& sc )
80  : m_obj( obj ), m_svc( svc ), m_evt( evt ), m_sc( &sc ), m_customEvtType( false ) {
81  i_before();
82 }
84  const StatusCode& sc )
85  : m_obj( obj )
86  , m_svc( svc )
87  , m_evt( IAuditor::Initialize )
88  , // Windows needs an explicit value
89  m_cevt( std::move( evt ) )
90  , m_sc( &sc )
91  , m_customEvtType( true ) {
92  i_before();
93 }
95  : m_objName( std::move( name ) ), m_svc( svc ), m_evt( evt ), m_customEvtType( false ) {
96  i_before();
97 }
99  : m_objName( std::move( name ) )
100  , m_svc( svc )
101  , m_evt( IAuditor::Initialize )
102  , // Windows needs an explicit value
103  m_cevt( std::move( evt ) )
104  , m_customEvtType( true ) {
105  i_before();
106 }
108  const StatusCode& sc )
109  : m_objName( std::move( name ) ), m_svc( svc ), m_evt( evt ), m_sc( &sc ), m_customEvtType( false ) {
110  i_before();
111 }
113  const StatusCode& sc )
114  : m_objName( std::move( name ) )
115  , m_svc( svc )
116  , m_evt( IAuditor::Initialize )
117  , // Windows needs an explicit value
118  m_cevt( std::move( evt ) )
119  , m_sc( &sc )
120  , m_customEvtType( true ) {
121  i_before();
122 }
123 // ============================================================================
124 // destructor
125 // ============================================================================
127 // ============================================================================
129 // ============================================================================
IOTest.evt
evt
Definition: IOTest.py:107
std::string
STL class.
std::exception
STL class.
Gaudi.Configuration.log
log
Definition: Configuration.py:28
System.h
Gaudi::Guards::ExceptionGuard::~ExceptionGuard
~ExceptionGuard()
destructor
Definition: Guards.cpp:61
GaudiException.h
GaudiException
Definition: GaudiException.h:31
Gaudi::Guards::ExceptionGuard::handle
void handle(const GaudiException &e, MsgStream &s)
local handler of GaudiException
Definition: Guards.cpp:34
System::typeinfoName
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
Definition: System.cpp:315
Gaudi::Guards::ExceptionGuard::m_sc
StatusCode m_sc
status code : result of function evaluation
Definition: Guards.h:168
StatusCode
Definition: StatusCode.h:65
Gaudi::Guards::AuditorGuard::AuditorGuard
AuditorGuard()=delete
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:202
GaudiException::tag
virtual const std::string & tag() const
name tag for the exception, or exception type
Definition: GaudiException.h:77
MsgStream
Definition: MsgStream.h:33
MSG::FATAL
@ FATAL
Definition: IMessageSvc.h:25
Gaudi::Guards::AuditorGuard::i_before
void i_before()
Definition: Guards.h:265
GaudiException::code
virtual const StatusCode & code() const
StatusCode for Exception.
Definition: GaudiException.h:86
INamedInterface
Definition: INamedInterface.h:25
ConditionsStallTest.name
name
Definition: ConditionsStallTest.py:77
std
STL namespace.
IAuditor::StandardEventType
StandardEventType
Defines the standard (= used by the framework) auditable event types.
Definition: IAuditor.h:34
MSG::ERROR
@ ERROR
Definition: IMessageSvc.h:25
Guards.h
Gaudi::Guards::AuditorGuard::~AuditorGuard
~AuditorGuard()
dectructor
Definition: Guards.cpp:126
IAuditor
Definition: IAuditor.h:28
std::exception::what
T what(T... args)
MsgStream.h