The Gaudi Framework  master (d98a2936)
ExceptionSvc.h
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 \***********************************************************************************/
11 #pragma once
12 // ============================================================================
13 // Include files
14 // ============================================================================
15 // GaudiKernel
16 // ============================================================================
18 #include <GaudiKernel/MsgStream.h>
19 #include <GaudiKernel/Service.h>
20 // ============================================================================
27 // ============================================================================
28 class ExceptionSvc : public extends<Service, IExceptionSvc> {
29 public:
31  StatusCode handle( const INamedInterface& o, const GaudiException& e ) const override;
32  StatusCode handle( const INamedInterface& o, const std::exception& e ) const override;
34  StatusCode handle( const INamedInterface& o ) const override;
36  StatusCode handleErr( const INamedInterface& o, const StatusCode& s ) const override;
38 public:
40  StatusCode initialize() override;
41 
42 public:
43  using extends::extends;
44 
45 private:
46  // default constructor is disabled
47  ExceptionSvc() = delete;
48  // copy constructor is disabled
49  ExceptionSvc( const ExceptionSvc& ) = delete;
50  // assignment operator is disabled
51  ExceptionSvc& operator=( const ExceptionSvc& ) = delete;
52  // process exceptions
53  virtual StatusCode process( const INamedInterface& o ) const;
54 
55 private:
56  enum Policy { ALL, NONE };
58 
60  std::map<std::string, ReturnState> m_retCodesExc, m_retCodesErr;
61 
62  Gaudi::Property<std::string> m_mode_exc_s{ this, "Catch", "ALL" };
63  Gaudi::Property<std::string> m_mode_err_s{ this, "Errors", "NONE" };
64 };
65 
66 // ============================================================================
ExceptionSvc::process
virtual StatusCode process(const INamedInterface &o) const
Definition: ExceptionSvc.cpp:180
ExceptionSvc::m_mode_exc
Policy m_mode_exc
Definition: ExceptionSvc.h:59
ExceptionSvc::ExceptionSvc
ExceptionSvc(const ExceptionSvc &)=delete
ExceptionSvc::ReturnState
ReturnState
Definition: ExceptionSvc.h:57
gaudirun.s
string s
Definition: gaudirun.py:346
ExceptionSvc::RETHROW
@ RETHROW
Definition: ExceptionSvc.h:57
GaudiException
Definition: GaudiException.h:29
ExceptionSvc::m_mode_err
Policy m_mode_err
Definition: ExceptionSvc.h:59
ExceptionSvc::m_retCodesErr
std::map< std::string, ReturnState > m_retCodesErr
Definition: ExceptionSvc.h:60
ExceptionSvc::operator=
ExceptionSvc & operator=(const ExceptionSvc &)=delete
ExceptionSvc::RECOVERABLE
@ RECOVERABLE
Definition: ExceptionSvc.h:57
ExceptionSvc::initialize
StatusCode initialize() override
initialize the service
Definition: ExceptionSvc.cpp:40
IExceptionSvc.h
ExceptionSvc::m_retCodesExc
std::map< std::string, ReturnState > m_retCodesExc
Definition: ExceptionSvc.h:60
ExceptionSvc::handleErr
StatusCode handleErr(const INamedInterface &o, const StatusCode &s) const override
Handle errors.
Definition: ExceptionSvc.cpp:149
StatusCode
Definition: StatusCode.h:64
ExceptionSvc::handle
StatusCode handle(const INamedInterface &o, const GaudiException &e) const override
Handle caught GaudiExceptions.
Definition: ExceptionSvc.cpp:218
ExceptionSvc::ALL
@ ALL
Definition: ExceptionSvc.h:56
ExceptionSvc::ExceptionSvc
ExceptionSvc()=delete
no default constructor
ExceptionSvc::SUCCESS
@ SUCCESS
Definition: ExceptionSvc.h:57
ExceptionSvc::DEFAULT
@ DEFAULT
Definition: ExceptionSvc.h:57
ExceptionSvc::NONE
@ NONE
Definition: ExceptionSvc.h:56
extends
Base class used to extend a class implementing other interfaces.
Definition: extends.h:19
ExceptionSvc::m_mode_err_s
Gaudi::Property< std::string > m_mode_err_s
Definition: ExceptionSvc.h:63
Service.h
INamedInterface
Definition: INamedInterface.h:23
ExceptionSvc::Policy
Policy
Definition: ExceptionSvc.h:56
ExceptionSvc::m_mode_exc_s
Gaudi::Property< std::string > m_mode_exc_s
Definition: ExceptionSvc.h:62
ExceptionSvc::FAILURE
@ FAILURE
Definition: ExceptionSvc.h:57
Gaudi::Property< std::string >
MsgStream.h
ExceptionSvc
Definition: ExceptionSvc.h:28