| The Gaudi Framework v29r1 (5cd95fa2)

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | Protected Attributes | Static Protected Attributes | Friends | List of all members
GaudiException Class Reference

Define general base for Gaudi exception. More...

`#include <GaudiKernel/GaudiException.h>`

Inheritance diagram for GaudiException:
[legend]
Collaboration diagram for GaudiException:
[legend]

## Public Member Functions
| GaudiException (std::string Message, std::string Tag, StatusCode Code)
| Constructor (1) More...
| GaudiException (std::string Message, std::string Tag, StatusCode Code, const GaudiException &Exception)
| Constructor (2) More...
| GaudiException (std::string Message, std::string Tag, StatusCode Code, const std::exception &Exception)
| Constructor (3) More...
| GaudiException (const GaudiException &Exception)
| Copy constructor (deep copying!) More...
virtual | ~GaudiException () throw ()
| destructor (perform the deletion of "previous" field!) More...
GaudiException & | operator= (const GaudiException &Exception)
| assignment operator More...
virtual const std::string & | message () const
| error message to be printed More...
virtual const std::string & | setMessage (const std::string &newMessage)
| update the error message to be printed More...
virtual const std::string & | tag () const
| name tag for the exception, or exception type More...
virtual const std::string & | setTag (const std::string &newTag)
| update name tag More...
virtual const StatusCode & | code () const
| StatusCode for Exception. More...
virtual const StatusCode & | setCode (const StatusCode &newStatus)
| update the status code for the exception More...
virtual GaudiException * | previous () const
| get the previous exception ( "previous" element in the linked list) More...
virtual std::ostream & | printOut (std::ostream &os=std::cerr) const
| methods for overloaded printout to std::ostream& and MsgStream& More...
virtual MsgStream & | printOut (MsgStream &os) const
| Output the exception to the Gaudi MsgStream. More...
virtual GaudiException * | clone () const
| clone operation More...
const char * | what () const override throw ()
| method from std::exception More...
Public Member Functions inherited from std::exception
T | what (T...args)
T | ~exception (T...args)
T | operator= (T...args)
T | exception (T...args)

## Protected Attributes
std::string | m_message
std::string | m_tag
| error message More...
StatusCode | m_code
| exception tag More...
std::unique_ptr< GaudiException > | m_previous
| status code for exception More...

## Static Protected Attributes
static bool | s_proc
| "previous" element in the linked list More...

## Friends
class | StatusCode
std::ostream & | operator<< (std::ostream &os, const GaudiException &ge)
| overloaded printout to std::ostream More...
std::ostream & | operator<< (std::ostream &os, const GaudiException *pge)
MsgStream & | operator<< (MsgStream &os, const GaudiException &ge)
| overloaded printout to MsgStream More...
MsgStream & | operator<< (MsgStream &os, const GaudiException *pge)
| overloaded printout to MsgStream More...

## Detailed Description

Define general base for Gaudi exception.

Author
  Vanya Belyaev
  Sebastien Ponce

Definition at line 22 of file GaudiException.h.

## Constructor & Destructor Documentation

GaudiException::GaudiException | ( | std::string | Message,
|  | std::string | Tag,
|  | StatusCode | Code
| ) |  |
| inline

Constructor (1)

Parameters

  Message | error message
  Tag | "name tag", or exeption type
  Code | status code

Definition at line 37 of file GaudiException.h.

38 : m_message( std::move( Message ) ), m_tag( std::move( Tag ) ), m_code( std::move( Code ) )
39 {
40 s_proc = true;
41 }
GaudiException::s_proc
static bool s_proc
"previous" element in the linked list
Definition: GaudiException.h:178
GaudiException::m_tag
std::string m_tag
error message
Definition: GaudiException.h:175
GaudiException::m_message
std::string m_message
Definition: GaudiException.h:174
std::move
T move(T...args)
GaudiException::m_code
StatusCode m_code
exception tag
Definition: GaudiException.h:176

GaudiException::GaudiException | ( | std::string | Message,
|  | std::string | Tag,
|  | StatusCode | Code,
|  | const GaudiException & | Exception
| ) |  |
| inline

Constructor (2)

Parameters

  Message | error message
  Tag | "name tag", or exeption type
  Code | status code
  Exception | "previous" exception

Definition at line 49 of file GaudiException.h.

50 : m_message( std::move( Message ) )
51 , m_tag( std::move( Tag ) )
52 , m_code( std::move( Code ) )
53 , m_previous( Exception.clone() )
54 {
55 }
GaudiException::m_tag
std::string m_tag
error message
Definition: GaudiException.h:175
GaudiException::m_message
std::string m_message
Definition: GaudiException.h:174
GaudiException::clone
virtual GaudiException * clone() const
clone operation
Definition: GaudiException.h:168
std::move
T move(T...args)
GaudiException::m_code
StatusCode m_code
exception tag
Definition: GaudiException.h:176
GaudiException::m_previous
std::unique_ptr< GaudiException > m_previous
status code for exception
Definition: GaudiException.h:177

GaudiException::GaudiException | ( | std::string | Message,
|  | std::string | Tag,
|  | StatusCode | Code,
|  | const std::exception & | Exception
| ) |  |
| inline

Constructor (3)

Parameters

  Message | error message
  Tag | "name tag", or exeption type
  Code | status code
  Exception | "previous" exception (used to improve the error message)

Definition at line 63 of file GaudiException.h.

64 : m_message( std::move( Message ) ), m_tag( std::move( Tag ) ), m_code( std::move( Code ) )
65 {
66 s_proc = true;
67 m_message += ": " + System::typeinfoName( typeid( Exception ) ) + ", " + Exception.what();
68 }
System::typeinfoName
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
Definition: System.cpp:329
GaudiException::s_proc
static bool s_proc
"previous" element in the linked list
Definition: GaudiException.h:178
GaudiException::m_tag
std::string m_tag
error message
Definition: GaudiException.h:175
GaudiException::m_message
std::string m_message
Definition: GaudiException.h:174
std::exception::what
T what(T...args)
std::move
T move(T...args)
GaudiException::m_code
StatusCode m_code
exception tag
Definition: GaudiException.h:176

GaudiException::GaudiException | ( | const GaudiException & | Exception | ) |
| inline

Copy constructor (deep copying!)

Definition at line 71 of file GaudiException.h.

72 : std::exception( Exception )
73 , m_message{Exception.message()}
74 , m_tag{Exception.tag()}
75 , m_code{Exception.code()}
76 , m_previous{Exception.previous() ? Exception.previous()->clone() : nullptr}
77 {
78 s_proc = true;
79 }
GaudiException::message
virtual const std::string & message() const
error message to be printed
Definition: GaudiException.h:99
GaudiException::s_proc
static bool s_proc
"previous" element in the linked list
Definition: GaudiException.h:178
GaudiException::m_tag
std::string m_tag
error message
Definition: GaudiException.h:175
GaudiException::code
virtual const StatusCode & code() const
StatusCode for Exception.
Definition: GaudiException.h:119
GaudiException::m_message
std::string m_message
Definition: GaudiException.h:174
GaudiException::previous
virtual GaudiException * previous() const
get the previous exception ( "previous" element in the linked list)
Definition: GaudiException.h:129
GaudiException::clone
virtual GaudiException * clone() const
clone operation
Definition: GaudiException.h:168
GaudiException::tag
virtual const std::string & tag() const
name tag for the exception, or exception type
Definition: GaudiException.h:109
std::exception
STL class.
GaudiException::m_code
StatusCode m_code
exception tag
Definition: GaudiException.h:176
GaudiException::m_previous
std::unique_ptr< GaudiException > m_previous
status code for exception
Definition: GaudiException.h:177

virtual GaudiException::~GaudiException | ( |  | ) |
throw | ( |
| ) |  |
| inline virtual

destructor (perform the deletion of "previous" field!)

Definition at line 82 of file GaudiException.h.

83 {
84 m_code.setChecked();
85 s_proc = false;
86 }
GaudiException::s_proc
static bool s_proc
"previous" element in the linked list
Definition: GaudiException.h:178
GaudiException::m_code
StatusCode m_code
exception tag
Definition: GaudiException.h:176
StatusCode::setChecked
void setChecked() const
Ignore the checking code;.
Definition: StatusCode.h:108

## Member Function Documentation

virtual GaudiException* GaudiException::clone | ( |  | ) | const
| inline virtual

clone operation

Reimplemented in UpdateManagerException.

Definition at line 168 of file GaudiException.h.

168 { return new GaudiException( *this ); }
GaudiException::GaudiException
GaudiException(std::string Message, std::string Tag, StatusCode Code)
Constructor (1)
Definition: GaudiException.h:37

virtual const StatusCode& GaudiException::code | ( |  | ) | const
| inline virtual

StatusCode for Exception.

Definition at line 119 of file GaudiException.h.

119 { return m_code; }
GaudiException::m_code
StatusCode m_code
exception tag
Definition: GaudiException.h:176

virtual const std::string& GaudiException::message | ( |  | ) | const
| inline virtual

error message to be printed

Definition at line 99 of file GaudiException.h.

99 { return m_message; }
GaudiException::m_message
std::string m_message
Definition: GaudiException.h:174

GaudiException& GaudiException::operator= | ( | const GaudiException & | Exception | ) |
| inline

assignment operator

Definition at line 89 of file GaudiException.h.

90 {
91 m_message = Exception.message();
92 m_tag = Exception.tag();
93 m_code = Exception.code();
94 m_previous.reset( Exception.previous() ? Exception.previous()->clone() : nullptr );
95 return *this;
96 }
GaudiException::message
virtual const std::string & message() const
error message to be printed
Definition: GaudiException.h:99
GaudiException::m_tag
std::string m_tag
error message
Definition: GaudiException.h:175
GaudiException::code
virtual const StatusCode & code() const
StatusCode for Exception.
Definition: GaudiException.h:119
GaudiException::m_message
std::string m_message
Definition: GaudiException.h:174
GaudiException::previous
virtual GaudiException * previous() const
get the previous exception ( "previous" element in the linked list)
Definition: GaudiException.h:129
GaudiException::clone
virtual GaudiException * clone() const
clone operation
Definition: GaudiException.h:168
GaudiException::tag
virtual const std::string & tag() const
name tag for the exception, or exception type
Definition: GaudiException.h:109
std::unique_ptr::reset
T reset(T...args)
GaudiException::m_code
StatusCode m_code
exception tag
Definition: GaudiException.h:176
GaudiException::m_previous
std::unique_ptr< GaudiException > m_previous
status code for exception
Definition: GaudiException.h:177

virtual GaudiException* GaudiException::previous | ( |  | ) | const
| inline virtual

get the previous exception ( "previous" element in the linked list)

Definition at line 129 of file GaudiException.h.

129 { return m_previous.get(); }
std::unique_ptr::get
T get(T...args)
GaudiException::m_previous
std::unique_ptr< GaudiException > m_previous
status code for exception
Definition: GaudiException.h:177

virtual std::ostream& GaudiException::printOut | ( | std::ostream & | os = `std::cerr` | ) | const
| inline virtual

methods for overloaded printout to std::ostream& and MsgStream&

Definition at line 132 of file GaudiException.h.

133 {
134 os << tag() << " \t " << message();
135 switch ( code() ) {
136 case StatusCode::SUCCESS:
137 os << "\t StatusCode=SUCCESS";
138 break;
139 case StatusCode::FAILURE:
140 os << "\t StatusCode=FAILURE";
141 break;
142 default:
143 os << "\t StatusCode=" << code();
144 break;
145 }
146 return ( 0 != previous() ) ? previous()->printOut( os << std::endl ) : os;
147 }
GaudiException::message
virtual const std::string & message() const
error message to be printed
Definition: GaudiException.h:99
StatusCode::SUCCESS
Definition: StatusCode.h:31
StatusCode::FAILURE
Definition: StatusCode.h:31
std::endl
T endl(T...args)
GaudiException::code
virtual const StatusCode & code() const
StatusCode for Exception.
Definition: GaudiException.h:119
GaudiException::previous
virtual GaudiException * previous() const
get the previous exception ( "previous" element in the linked list)
Definition: GaudiException.h:129
GaudiException::tag
virtual const std::string & tag() const
name tag for the exception, or exception type
Definition: GaudiException.h:109
GaudiException::printOut
virtual std::ostream & printOut(std::ostream &os=std::cerr) const
methods for overloaded printout to std::ostream& and MsgStream&
Definition: GaudiException.h:132

virtual MsgStream& GaudiException::printOut | ( | MsgStream & | os | ) | const
| inline virtual

Output the exception to the Gaudi MsgStream.

Definition at line 150 of file GaudiException.h.

151 {
152 os << tag() << "\t" << message();
153 switch ( code() ) {
154 case StatusCode::SUCCESS:
155 os << "\t StatusCode=SUCCESS";
156 break;
157 case StatusCode::FAILURE:
158 os << "\t StatusCode=FAILURE";
159 break;
160 default:
161 os << "\t StatusCode=" << code().getCode();
162 break;
163 }
164 return ( 0 != previous() ) ? previous()->printOut( os << endmsg ) : os;
165 }
GaudiException::message
virtual const std::string & message() const
error message to be printed
Definition: GaudiException.h:99
StatusCode::SUCCESS
Definition: StatusCode.h:31
StatusCode::FAILURE
Definition: StatusCode.h:31
StatusCode::getCode
unsigned long getCode() const
Get the status code by value.
Definition: StatusCode.h:94
GaudiException::code
virtual const StatusCode & code() const
StatusCode for Exception.
Definition: GaudiException.h:119
GaudiException::previous
virtual GaudiException * previous() const
get the previous exception ( "previous" element in the linked list)
Definition: GaudiException.h:129
GaudiException::tag
virtual const std::string & tag() const
name tag for the exception, or exception type
Definition: GaudiException.h:109
GaudiException::printOut
virtual std::ostream & printOut(std::ostream &os=std::cerr) const
methods for overloaded printout to std::ostream& and MsgStream&
Definition: GaudiException.h:132
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:209

virtual const StatusCode& GaudiException::setCode | ( | const StatusCode & | newStatus | ) |
| inline virtual

update the status code for the exception

Definition at line 122 of file GaudiException.h.

123 {
124 m_code = newStatus;
125 return code();
126 }
GaudiException::code
virtual const StatusCode & code() const
StatusCode for Exception.
Definition: GaudiException.h:119
GaudiException::m_code
StatusCode m_code
exception tag
Definition: GaudiException.h:176

virtual const std::string& GaudiException::setMessage | ( | const std::string & | newMessage | ) |
| inline virtual

update the error message to be printed

Definition at line 102 of file GaudiException.h.

103 {
104 m_message = newMessage;
105 return message();
106 }
GaudiException::message
virtual const std::string & message() const
error message to be printed
Definition: GaudiException.h:99
GaudiException::m_message
std::string m_message
Definition: GaudiException.h:174

virtual const std::string& GaudiException::setTag | ( | const std::string & | newTag | ) |
| inline virtual

update name tag

Definition at line 112 of file GaudiException.h.

113 {
114 m_tag = newTag;
115 return tag();
116 }
GaudiException::m_tag
std::string m_tag
error message
Definition: GaudiException.h:175
GaudiException::tag
virtual const std::string & tag() const
name tag for the exception, or exception type
Definition: GaudiException.h:109

virtual const std::string& GaudiException::tag | ( |  | ) | const
| inline virtual

name tag for the exception, or exception type

Definition at line 109 of file GaudiException.h.

109 { return m_tag; }
GaudiException::m_tag
std::string m_tag
error message
Definition: GaudiException.h:175

const char* GaudiException::what | ( |  | ) | const
throw | ( |
| ) |  |
| inline override

method from std::exception

Definition at line 171 of file GaudiException.h.

171 { return message().c_str(); }
GaudiException::message
virtual const std::string & message() const
error message to be printed
Definition: GaudiException.h:99
std::string::c_str
T c_str(T...args)

## Friends And Related Function Documentation

std::ostream& operator<< | ( | std::ostream & | os,
|  | const GaudiException & | ge
| ) |  |
| friend

overloaded printout to std::ostream

Definition at line 182 of file GaudiException.h.

182 { return ge.printOut( os ); }
GaudiException::printOut
virtual std::ostream & printOut(std::ostream &os=std::cerr) const
methods for overloaded printout to std::ostream& and MsgStream&
Definition: GaudiException.h:132

std::ostream& operator<< | ( | std::ostream & | os,
|  | const GaudiException * | pge
| ) |  |
| friend

Definition at line 183 of file GaudiException.h.

184 {
185 return ( 0 == pge ) ? ( os << " GaudiException* points to NULL!" ) : ( os << *pge );
186 }

MsgStream& operator<< | ( | MsgStream & | os,
|  | const GaudiException & | ge
| ) |  |
| friend

overloaded printout to MsgStream

Definition at line 189 of file GaudiException.h.

189 { return ge.printOut( os ); }
GaudiException::printOut
virtual std::ostream & printOut(std::ostream &os=std::cerr) const
methods for overloaded printout to std::ostream& and MsgStream&
Definition: GaudiException.h:132

MsgStream& operator<< | ( | MsgStream & | os,
|  | const GaudiException * | pge
| ) |  |
| friend

overloaded printout to MsgStream

Definition at line 191 of file GaudiException.h.

192 {
193 return ( 0 == pge ) ? ( os << " GaudiException* points to NULL!" ) : ( os << *pge );
194 }

friend class StatusCode
| friend

Definition at line 29 of file GaudiException.h.

## Member Data Documentation

StatusCode GaudiException::m_code
| mutable protected

exception tag

Definition at line 176 of file GaudiException.h.

std::string GaudiException::m_message
| mutable protected

Definition at line 174 of file GaudiException.h.

std::unique_ptr<GaudiException> GaudiException::m_previous
| mutable protected

status code for exception

Definition at line 177 of file GaudiException.h.

std::string GaudiException::m_tag
| mutable protected

error message

Definition at line 175 of file GaudiException.h.

bool GaudiException::s_proc
| static protected

"previous" element in the linked list

Definition at line 178 of file GaudiException.h.

The documentation for this class was generated from the following files:

- GaudiKernel/GaudiKernel/GaudiException.h
- GaudiKernel/src/Lib/GaudiException.cpp