The Gaudi Framework
master (bdbe7744)
Toggle main menu visibility
Loading...
Searching...
No Matches
GaudiException.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 <
GaudiKernel/Kernel.h
>
14
#include <
GaudiKernel/MsgStream.h
>
15
#include <
GaudiKernel/StatusCode.h
>
16
#include <exception>
17
#include <memory>
18
#include <ostream>
19
#include <string>
20
29
class
GAUDI_API
GaudiException
:
virtual
public
std::exception {
30
friend
class
StatusCode
;
31
32
public
:
38
GaudiException
( std::string
Message
, std::string Tag,
StatusCode
Code );
39
46
GaudiException
( std::string
Message
, std::string Tag,
StatusCode
Code,
const
GaudiException
& Exception );
47
54
GaudiException
( std::string
Message
, std::string Tag,
StatusCode
Code,
const
std::exception& Exception );
55
57
GaudiException
(
const
GaudiException
& Exception );
58
60
virtual
~GaudiException
() throw();
61
63
GaudiException
& operator=( const
GaudiException
& Exception );
64
66
virtual const
std
::
string
&
message
()
const
{
return
m_message
; }
67
69
virtual
const
std::string&
setMessage
(
const
std::string& newMessage ) {
70
m_message
= newMessage;
71
return
message
();
72
}
73
75
virtual
const
std::string&
tag
()
const
{
return
m_tag
; }
76
78
virtual
const
std::string&
setTag
(
const
std::string& newTag ) {
79
m_tag
= newTag;
80
return
tag
();
81
}
82
84
virtual
const
StatusCode
&
code
()
const
{
return
m_code
; }
85
87
virtual
const
StatusCode
&
setCode
(
const
StatusCode
& newStatus ) {
88
m_code
= newStatus;
89
return
code
();
90
}
91
93
virtual
GaudiException
*
previous
()
const
{
return
m_previous
.get(); }
94
96
virtual
const
std::string&
backTrace
()
const
{
return
m_backTrace
; }
97
99
virtual
std::ostream& printOut( std::ostream& os = std::cerr )
const
;
100
102
virtual
MsgStream
& printOut(
MsgStream
& os )
const
;
103
105
virtual
GaudiException
*
clone
()
const
{
return
new
GaudiException
( *
this
); }
106
108
const
char
*
what
()
const
throw()
override
{
return
message
().c_str(); }
109
111
friend
std::ostream&
operator<<
( std::ostream& os,
const
GaudiException
& ge );
112
114
friend
std::ostream&
operator<<
( std::ostream& os,
const
GaudiException
* pge );
115
117
friend
MsgStream
&
operator<<
(
MsgStream
& os,
const
GaudiException
& ge );
118
120
friend
MsgStream
&
operator<<
(
MsgStream
& os,
const
GaudiException
* pge );
121
122
protected
:
123
std::string
m_message
;
124
std::string
m_tag
;
125
StatusCode
m_code
;
126
std::string
m_backTrace
;
127
std::unique_ptr<GaudiException>
m_previous
;
128
static
bool
s_proc
;
129
};
Kernel.h
GAUDI_API
#define GAUDI_API
Definition
Kernel.h:49
MsgStream.h
StatusCode.h
GaudiException
Define general base for Gaudi exception.
Definition
GaudiException.h:29
GaudiException::message
virtual const std::string & message() const
error message to be printed
Definition
GaudiException.h:66
GaudiException::s_proc
static bool s_proc
"previous" element in the linked list
Definition
GaudiException.h:128
GaudiException::code
virtual const StatusCode & code() const
StatusCode for Exception.
Definition
GaudiException.h:84
GaudiException::GaudiException
GaudiException(std::string Message, std::string Tag, StatusCode Code)
Constructor (1).
Definition
GaudiException.cpp:26
GaudiException::m_message
std::string m_message
Definition
GaudiException.h:123
GaudiException::m_code
StatusCode m_code
exception tag
Definition
GaudiException.h:125
GaudiException::setTag
virtual const std::string & setTag(const std::string &newTag)
update name tag
Definition
GaudiException.h:78
GaudiException::StatusCode
friend class StatusCode
Definition
GaudiException.h:30
GaudiException::clone
virtual GaudiException * clone() const
clone operation
Definition
GaudiException.h:105
GaudiException::setMessage
virtual const std::string & setMessage(const std::string &newMessage)
update the error message to be printed
Definition
GaudiException.h:69
GaudiException::m_previous
std::unique_ptr< GaudiException > m_previous
stack trace at instantiation
Definition
GaudiException.h:127
GaudiException::m_tag
std::string m_tag
error message
Definition
GaudiException.h:124
GaudiException::what
const char * what() const override
method from std::exception
Definition
GaudiException.h:108
GaudiException::m_backTrace
std::string m_backTrace
status code for exception
Definition
GaudiException.h:126
GaudiException::backTrace
virtual const std::string & backTrace() const
return the stack trace at instantiation
Definition
GaudiException.h:96
GaudiException::previous
virtual GaudiException * previous() const
get the previous exception ( "previous" element in the linked list)
Definition
GaudiException.h:93
GaudiException::tag
virtual const std::string & tag() const
name tag for the exception, or exception type
Definition
GaudiException.h:75
GaudiException::setCode
virtual const StatusCode & setCode(const StatusCode &newStatus)
update the status code for the exception
Definition
GaudiException.h:87
Message
The Message class.
Definition
Message.h:25
MsgStream
Definition of the MsgStream class used to transmit messages.
Definition
MsgStream.h:29
std
STL namespace.
std::operator<<
ostream & operator<<(ostream &s, const MyCustomType &m)
Definition
CustomPropertiesAlg.cpp:47
GaudiKernel
include
GaudiKernel
GaudiException.h
Generated on
for The Gaudi Framework by
1.17.0