The Gaudi Framework  v30r3 (a5ef0a68)
GaudiException Class Reference

Define general base for Gaudi exception. More...

#include <GaudiKernel/GaudiException.h>

Inheritance diagram for GaudiException:
Collaboration diagram for GaudiException:

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...
 
GaudiExceptionoperator= (const GaudiException &Exception)
 assignment operator More...
 
virtual const std::stringmessage () const
 error message to be printed More...
 
virtual const std::stringsetMessage (const std::string &newMessage)
 update the error message to be printed More...
 
virtual const std::stringtag () const
 name tag for the exception, or exception type More...
 
virtual const std::stringsetTag (const std::string &newTag)
 update name tag More...
 
virtual const StatusCodecode () const
 StatusCode for Exception. More...
 
virtual const StatusCodesetCode (const StatusCode &newStatus)
 update the status code for the exception More...
 
virtual GaudiExceptionprevious () const
 get the previous exception ( "previous" element in the linked list) More...
 
virtual std::ostreamprintOut (std::ostream &os=std::cerr) const
 methods for overloaded printout to std::ostream& and MsgStream& More...
 
virtual MsgStreamprintOut (MsgStream &os) const
 Output the exception to the Gaudi MsgStream. More...
 
virtual GaudiExceptionclone () const
 clone operation More...
 
const char * what () const override throw ()
 method from std::exception More...
 
- Public Member Functions inherited from std::exception
what (T...args)
 
~exception (T...args)
 
operator= (T...args)
 
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< GaudiExceptionm_previous
 status code for exception More...
 

Static Protected Attributes

static bool s_proc
 "previous" element in the linked list More...
 

Friends

class StatusCode
 
std::ostreamoperator<< (std::ostream &os, const GaudiException &ge)
 overloaded printout to std::ostream More...
 
std::ostreamoperator<< (std::ostream &os, const GaudiException *pge)
 
MsgStreamoperator<< (MsgStream &os, const GaudiException &ge)
 overloaded printout to MsgStream More...
 
MsgStreamoperator<< (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
Messageerror message
Tag"name tag", or exeption type
Codestatus 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  }
static bool s_proc
"previous" element in the linked list
std::string m_tag
error message
std::string m_message
T move(T...args)
StatusCode m_code
exception tag
GaudiException::GaudiException ( std::string  Message,
std::string  Tag,
StatusCode  Code,
const GaudiException Exception 
)
inline

Constructor (2)

Parameters
Messageerror message
Tag"name tag", or exeption type
Codestatus 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  }
std::string m_tag
error message
std::string m_message
virtual GaudiException * clone() const
clone operation
T move(T...args)
StatusCode m_code
exception tag
std::unique_ptr< GaudiException > m_previous
status code for exception
GaudiException::GaudiException ( std::string  Message,
std::string  Tag,
StatusCode  Code,
const std::exception Exception 
)
inline

Constructor (3)

Parameters
Messageerror message
Tag"name tag", or exeption type
Codestatus 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  }
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
Definition: System.cpp:332
static bool s_proc
"previous" element in the linked list
std::string m_tag
error message
std::string m_message
T what(T...args)
T move(T...args)
StatusCode m_code
exception tag
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  }
virtual const std::string & message() const
error message to be printed
static bool s_proc
"previous" element in the linked list
std::string m_tag
error message
virtual const StatusCode & code() const
StatusCode for Exception.
std::string m_message
virtual GaudiException * previous() const
get the previous exception ( "previous" element in the linked list)
virtual GaudiException * clone() const
clone operation
virtual const std::string & tag() const
name tag for the exception, or exception type
STL class.
StatusCode m_code
exception tag
std::unique_ptr< GaudiException > m_previous
status code for exception
virtual GaudiException::~GaudiException ( )
throw (
)
inlinevirtual

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

Definition at line 82 of file GaudiException.h.

83  {
85  s_proc = false;
86  }
static bool s_proc
"previous" element in the linked list
const StatusCode & setChecked(bool checked=true) const
Check/uncheck StatusCode.
Definition: StatusCode.h:153
StatusCode m_code
exception tag

Member Function Documentation

virtual GaudiException* GaudiException::clone ( ) const
inlinevirtual

clone operation

Reimplemented in UpdateManagerException.

Definition at line 146 of file GaudiException.h.

146 { return new GaudiException( *this ); }
GaudiException(std::string Message, std::string Tag, StatusCode Code)
Constructor (1)
virtual const StatusCode& GaudiException::code ( ) const
inlinevirtual

StatusCode for Exception.

Definition at line 119 of file GaudiException.h.

119 { return m_code; }
StatusCode m_code
exception tag
virtual const std::string& GaudiException::message ( ) const
inlinevirtual

error message to be printed

Definition at line 99 of file GaudiException.h.

99 { return m_message; }
std::string m_message
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  }
virtual const std::string & message() const
error message to be printed
std::string m_tag
error message
virtual const StatusCode & code() const
StatusCode for Exception.
std::string m_message
virtual GaudiException * previous() const
get the previous exception ( "previous" element in the linked list)
virtual GaudiException * clone() const
clone operation
virtual const std::string & tag() const
name tag for the exception, or exception type
T reset(T...args)
StatusCode m_code
exception tag
std::unique_ptr< GaudiException > m_previous
status code for exception
virtual GaudiException* GaudiException::previous ( ) const
inlinevirtual

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

Definition at line 129 of file GaudiException.h.

129 { return m_previous.get(); }
T get(T...args)
std::unique_ptr< GaudiException > m_previous
status code for exception
virtual std::ostream& GaudiException::printOut ( std::ostream os = std::cerr) const
inlinevirtual

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

Definition at line 132 of file GaudiException.h.

133  {
134  os << tag() << " \t " << message() << "\t StatusCode=" << code();
135  return ( 0 != previous() ) ? previous()->printOut( os << std::endl ) : os;
136  }
virtual const std::string & message() const
error message to be printed
T endl(T...args)
virtual const StatusCode & code() const
StatusCode for Exception.
virtual GaudiException * previous() const
get the previous exception ( "previous" element in the linked list)
virtual const std::string & tag() const
name tag for the exception, or exception type
virtual std::ostream & printOut(std::ostream &os=std::cerr) const
methods for overloaded printout to std::ostream& and MsgStream&
virtual MsgStream& GaudiException::printOut ( MsgStream os) const
inlinevirtual

Output the exception to the Gaudi MsgStream.

Definition at line 139 of file GaudiException.h.

140  {
141  os << tag() << " \t " << message() << "\t StatusCode=" << code();
142  return ( 0 != previous() ) ? previous()->printOut( os << endmsg ) : os;
143  }
virtual const std::string & message() const
error message to be printed
virtual const StatusCode & code() const
StatusCode for Exception.
virtual GaudiException * previous() const
get the previous exception ( "previous" element in the linked list)
virtual const std::string & tag() const
name tag for the exception, or exception type
virtual std::ostream & printOut(std::ostream &os=std::cerr) const
methods for overloaded printout to std::ostream& and MsgStream&
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)
inlinevirtual

update the status code for the exception

Definition at line 122 of file GaudiException.h.

123  {
124  m_code = newStatus;
125  return code();
126  }
virtual const StatusCode & code() const
StatusCode for Exception.
StatusCode m_code
exception tag
virtual const std::string& GaudiException::setMessage ( const std::string newMessage)
inlinevirtual

update the error message to be printed

Definition at line 102 of file GaudiException.h.

103  {
104  m_message = newMessage;
105  return message();
106  }
virtual const std::string & message() const
error message to be printed
std::string m_message
virtual const std::string& GaudiException::setTag ( const std::string newTag)
inlinevirtual

update name tag

Definition at line 112 of file GaudiException.h.

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

name tag for the exception, or exception type

Definition at line 109 of file GaudiException.h.

109 { return m_tag; }
std::string m_tag
error message
const char* GaudiException::what ( ) const
throw (
)
inlineoverride

method from std::exception

Definition at line 149 of file GaudiException.h.

149 { return message().c_str(); }
virtual const std::string & message() const
error message to be printed
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 160 of file GaudiException.h.

160 { return ge.printOut( os ); }
virtual std::ostream & printOut(std::ostream &os=std::cerr) const
methods for overloaded printout to std::ostream& and MsgStream&
std::ostream& operator<< ( std::ostream os,
const GaudiException pge 
)
friend

Definition at line 161 of file GaudiException.h.

162 {
163  return ( 0 == pge ) ? ( os << " GaudiException* points to NULL!" ) : ( os << *pge );
164 }
MsgStream& operator<< ( MsgStream os,
const GaudiException ge 
)
friend

overloaded printout to MsgStream

Definition at line 167 of file GaudiException.h.

167 { return ge.printOut( os ); }
virtual std::ostream & printOut(std::ostream &os=std::cerr) const
methods for overloaded printout to std::ostream& and MsgStream&
MsgStream& operator<< ( MsgStream os,
const GaudiException pge 
)
friend

overloaded printout to MsgStream

Definition at line 169 of file GaudiException.h.

170 {
171  return ( 0 == pge ) ? ( os << " GaudiException* points to NULL!" ) : ( os << *pge );
172 }
friend class StatusCode
friend

Definition at line 29 of file GaudiException.h.

Member Data Documentation

StatusCode GaudiException::m_code
mutableprotected

exception tag

Definition at line 154 of file GaudiException.h.

std::string GaudiException::m_message
mutableprotected

Definition at line 152 of file GaudiException.h.

std::unique_ptr<GaudiException> GaudiException::m_previous
mutableprotected

status code for exception

Definition at line 155 of file GaudiException.h.

std::string GaudiException::m_tag
mutableprotected

error message

Definition at line 153 of file GaudiException.h.

bool GaudiException::s_proc
staticprotected

"previous" element in the linked list

Definition at line 156 of file GaudiException.h.


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