Loading [MathJax]/extensions/tex2jax.js
The Gaudi Framework  master (d98a2936)
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
Guards.cpp
Go to the documentation of this file.
1 /***********************************************************************************\
2 * (c) Copyright 1998-2025 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 \***********************************************************************************/
12 #include <GaudiKernel/Guards.h>
13 #include <GaudiKernel/MsgStream.h>
14 #include <GaudiKernel/System.h>
15 #include <exception>
16 
26  log << MSG::FATAL << System::typeinfoName( typeid( exc ) ) << "('" << exc.tag() << "') is caught!" << endmsg;
27  log << MSG::ERROR << exc << endmsg;
28  m_sc = exc.code();
29 }
30 
31 void Gaudi::Guards::ExceptionGuard::handle( const std::exception& exc, MsgStream& log ) {
32  log << MSG::FATAL << System::typeinfoName( typeid( exc ) ) << " is caught!" << endmsg;
33  log << MSG::ERROR << exc.what() << endmsg;
34 }
35 
37  log << MSG::FATAL << "UNKNOWN exception is caught!" << endmsg;
38 }
39 
41 
42 Gaudi::Guards::AuditorGuard::AuditorGuard( std::string name, IAuditor* svc, std::string const& evt,
43  EventContext const& context )
44  : m_objName( name ), m_svc( svc ), m_evt( evt ), m_context( context ) {
45  i_before();
46 }
47 
48 Gaudi::Guards::AuditorGuard::AuditorGuard( std::string name, IAuditor* svc, std::string const& evt,
49  StatusCode const& sc, EventContext const& context )
50  : m_objName( name ), m_svc( svc ), m_evt( evt ), m_sc( &sc ), m_context( context ) {
51  i_before();
52 }
IOTest.evt
evt
Definition: IOTest.py:107
Gaudi.Configuration.log
log
Definition: Configuration.py:28
System.h
Gaudi::Guards::ExceptionGuard::~ExceptionGuard
~ExceptionGuard()
destructor
Definition: Guards.cpp:40
GaudiException.h
Gaudi::IAuditor
The IAuditor is the interface implemented by the Auditor base class.
Definition: IAuditor.h:26
Gaudi::Guards::AuditorGuard::AuditorGuard
AuditorGuard(std::string name, IAuditor *svc, std::string const &evt, EventContext const &context={})
Definition: Guards.cpp:42
GaudiException
Definition: GaudiException.h:29
Gaudi::Guards::ExceptionGuard::handle
void handle(const GaudiException &e, MsgStream &s)
local handler of GaudiException
Definition: Guards.cpp:25
System::typeinfoName
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
Definition: System.cpp:260
Gaudi::Guards::ExceptionGuard::m_sc
StatusCode m_sc
status code : result of function evaluation
Definition: Guards.h:158
StatusCode
Definition: StatusCode.h:64
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:198
GaudiException::tag
virtual const std::string & tag() const
name tag for the exception, or exception type
Definition: GaudiException.h:75
MsgStream
Definition: MsgStream.h:29
MSG::FATAL
@ FATAL
Definition: IMessageSvc.h:22
Gaudi::Guards::AuditorGuard::i_before
void i_before()
Definition: Guards.h:237
GaudiException::code
virtual const StatusCode & code() const
StatusCode for Exception.
Definition: GaudiException.h:84
ConditionsStallTest.name
name
Definition: ConditionsStallTest.py:77
MSG::ERROR
@ ERROR
Definition: IMessageSvc.h:22
EventContext
Definition: EventContext.h:34
Guards.h
MsgStream.h