| The Gaudi Framework v32r1 (f65d50dc)

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 const std::string & | backTrace () const
| return the stack trace at instantiation 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::string | m_backTrace
| status code for exception More...
std::unique_ptr< GaudiException > | m_previous
| stack trace at instantiation More...

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

## Friends
class | StatusCode

## Detailed Description

Define general base for Gaudi exception.

Author
  Vanya Belyaev
  Sebastien Ponce

Definition at line 21 of file GaudiException.h.

## Constructor & Destructor Documentation

## ◆ GaudiException() [1/4]

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

Constructor (1)

Parameters

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

Definition at line 16 of file GaudiException.cpp.

17 : m_message( std::move( Message ) ), m_tag( std::move( Tag ) ), m_code( std::move( Code ) ) {
18 s_proc = true;
19 m_backTrace = captureBacktrace( Code );
20 }
GaudiException::s_proc
static bool s_proc
"previous" element in the linked list
Definition: GaudiException.h:108
GaudiException::m_tag
std::string m_tag
error message
Definition: GaudiException.h:104
GaudiException::m_message
std::string m_message
Definition: GaudiException.h:103
std::move
T move(T... args)
Message
The Message class.
Definition: Message.h:17
GaudiException::m_backTrace
std::string m_backTrace
status code for exception
Definition: GaudiException.h:106
GaudiException::m_code
StatusCode m_code
exception tag
Definition: GaudiException.h:105

## ◆ GaudiException() [2/4]

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

Constructor (2)

Parameters

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

Definition at line 22 of file GaudiException.cpp.

23 : m_message( std::move( Message ) )
24 , m_tag( std::move( Tag ) )
25 , m_code( std::move( Code ) )
26 , m_previous( Exception.clone() ) {
27 // Do not capture backtrace in outer chained exceptions, so only innermost exception is printed
28 }
GaudiException::m_tag
std::string m_tag
error message
Definition: GaudiException.h:104
GaudiException::m_message
std::string m_message
Definition: GaudiException.h:103
std::move
T move(T... args)
Message
The Message class.
Definition: Message.h:17
GaudiException::clone
virtual GaudiException * clone() const
clone operation
Definition: GaudiException.h:97
GaudiException::m_code
StatusCode m_code
exception tag
Definition: GaudiException.h:105
GaudiException::m_previous
std::unique_ptr< GaudiException > m_previous
stack trace at instantiation
Definition: GaudiException.h:107

## ◆ GaudiException() [3/4]

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

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 30 of file GaudiException.cpp.

31 : m_message( std::move( Message ) ), m_tag( std::move( Tag ) ), m_code( std::move( Code ) ) {
32 s_proc = true;
33 m_message += ": " + System::typeinfoName( typeid( Exception ) ) + ", " + Exception.what();
34 m_backTrace = captureBacktrace( Code );
35 }
System::typeinfoName
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
Definition: System.cpp:298
GaudiException::s_proc
static bool s_proc
"previous" element in the linked list
Definition: GaudiException.h:108
GaudiException::m_tag
std::string m_tag
error message
Definition: GaudiException.h:104
GaudiException::m_message
std::string m_message
Definition: GaudiException.h:103
std::exception::what
T what(T... args)
std::move
T move(T... args)
Message
The Message class.
Definition: Message.h:17
GaudiException::m_backTrace
std::string m_backTrace
status code for exception
Definition: GaudiException.h:106
GaudiException::m_code
StatusCode m_code
exception tag
Definition: GaudiException.h:105

## ◆ GaudiException() [4/4]

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

Copy constructor (deep copying!)

Definition at line 37 of file GaudiException.cpp.

38 : std::exception( Exception )
39 , m_message{Exception.message()}
40 , m_tag{Exception.tag()}
41 , m_code{Exception.code()}
42 , m_backTrace{Exception.backTrace()}
43 , m_previous{Exception.previous() ? Exception.previous()->clone() : nullptr} {
44 s_proc = true;
45 }
GaudiException::previous
virtual GaudiException * previous() const
get the previous exception ( "previous" element in the linked list)
Definition: GaudiException.h:85
GaudiException::s_proc
static bool s_proc
"previous" element in the linked list
Definition: GaudiException.h:108
GaudiException::tag
virtual const std::string & tag() const
name tag for the exception, or exception type
Definition: GaudiException.h:67
GaudiException::message
virtual const std::string & message() const
error message to be printed
Definition: GaudiException.h:58
GaudiException::m_tag
std::string m_tag
error message
Definition: GaudiException.h:104
GaudiException::m_message
std::string m_message
Definition: GaudiException.h:103
std::exception
STL class.
GaudiException::code
virtual const StatusCode & code() const
StatusCode for Exception.
Definition: GaudiException.h:76
GaudiException::clone
virtual GaudiException * clone() const
clone operation
Definition: GaudiException.h:97
GaudiException::m_backTrace
std::string m_backTrace
status code for exception
Definition: GaudiException.h:106
GaudiException::backTrace
virtual const std::string & backTrace() const
return the stack trace at instantiation
Definition: GaudiException.h:88
GaudiException::m_code
StatusCode m_code
exception tag
Definition: GaudiException.h:105
GaudiException::m_previous
std::unique_ptr< GaudiException > m_previous
stack trace at instantiation
Definition: GaudiException.h:107

## ◆ ~GaudiException()

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

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

Definition at line 47 of file GaudiException.cpp.

47 {
48 m_code.setChecked();
49 s_proc = false;
50 }
GaudiException::s_proc
static bool s_proc
"previous" element in the linked list
Definition: GaudiException.h:108
GaudiException::m_code
StatusCode m_code
exception tag
Definition: GaudiException.h:105
StatusCode::setChecked
const StatusCode & setChecked(bool checked=true) const
Check/uncheck StatusCode.
Definition: StatusCode.h:143

## Member Function Documentation

## ◆ backTrace()

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

return the stack trace at instantiation

Definition at line 88 of file GaudiException.h.

88 { return m_backTrace; }
GaudiException::m_backTrace
std::string m_backTrace
status code for exception
Definition: GaudiException.h:106

## ◆ clone()

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

clone operation

Reimplemented in UpdateManagerException.

Definition at line 97 of file GaudiException.h.

97 { return new GaudiException( *this ); }
GaudiException::GaudiException
GaudiException(std::string Message, std::string Tag, StatusCode Code)
Constructor (1)
Definition: GaudiException.cpp:16

## ◆ code()

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

StatusCode for Exception.

Definition at line 76 of file GaudiException.h.

76 { return m_code; }
GaudiException::m_code
StatusCode m_code
exception tag
Definition: GaudiException.h:105

## ◆ message()

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

error message to be printed

Definition at line 58 of file GaudiException.h.

58 { return m_message; }
GaudiException::m_message
std::string m_message
Definition: GaudiException.h:103

## ◆ operator=()

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

assignment operator

Definition at line 52 of file GaudiException.cpp.

52 {
53 m_message = Exception.message();
54 m_tag = Exception.tag();
55 m_code = Exception.code();
56 m_backTrace = Exception.backTrace();
57 m_previous.reset( Exception.previous() ? Exception.previous()->clone() : nullptr );
58 return *this;
59 }
GaudiException::previous
virtual GaudiException * previous() const
get the previous exception ( "previous" element in the linked list)
Definition: GaudiException.h:85
GaudiException::tag
virtual const std::string & tag() const
name tag for the exception, or exception type
Definition: GaudiException.h:67
GaudiException::message
virtual const std::string & message() const
error message to be printed
Definition: GaudiException.h:58
GaudiException::m_tag
std::string m_tag
error message
Definition: GaudiException.h:104
GaudiException::m_message
std::string m_message
Definition: GaudiException.h:103
std::unique_ptr::reset
T reset(T... args)
GaudiException::code
virtual const StatusCode & code() const
StatusCode for Exception.
Definition: GaudiException.h:76
GaudiException::clone
virtual GaudiException * clone() const
clone operation
Definition: GaudiException.h:97
GaudiException::m_backTrace
std::string m_backTrace
status code for exception
Definition: GaudiException.h:106
GaudiException::backTrace
virtual const std::string & backTrace() const
return the stack trace at instantiation
Definition: GaudiException.h:88
GaudiException::m_code
StatusCode m_code
exception tag
Definition: GaudiException.h:105
GaudiException::m_previous
std::unique_ptr< GaudiException > m_previous
stack trace at instantiation
Definition: GaudiException.h:107

## ◆ previous()

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

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

Definition at line 85 of file GaudiException.h.

85 { return m_previous.get(); }
std::unique_ptr::get
T get(T... args)
GaudiException::m_previous
std::unique_ptr< GaudiException > m_previous
stack trace at instantiation
Definition: GaudiException.h:107

## ◆ printOut() [1/2]

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

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

Definition at line 61 of file GaudiException.cpp.

61 {
62 os << tag() << " \t " << message() << "\t StatusCode=" << code();
63 if ( !backTrace().empty() ) os << std::endl << "Exception stack trace\n" << backTrace();
64 return ( 0 != previous() ) ? previous()->printOut( os << std::endl ) : os;
65 }
GaudiException::previous
virtual GaudiException * previous() const
get the previous exception ( "previous" element in the linked list)
Definition: GaudiException.h:85
std::endl
T endl(T... args)
GaudiException::tag
virtual const std::string & tag() const
name tag for the exception, or exception type
Definition: GaudiException.h:67
GaudiException::message
virtual const std::string & message() const
error message to be printed
Definition: GaudiException.h:58
GaudiException::code
virtual const StatusCode & code() const
StatusCode for Exception.
Definition: GaudiException.h:76
GaudiException::backTrace
virtual const std::string & backTrace() const
return the stack trace at instantiation
Definition: GaudiException.h:88
GaudiException::printOut
virtual std::ostream & printOut(std::ostream &os=std::cerr) const
methods for overloaded printout to std::ostream& and MsgStream&
Definition: GaudiException.cpp:61

## ◆ printOut() [2/2]

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

Output the exception to the Gaudi MsgStream.

Definition at line 67 of file GaudiException.cpp.

67 {
68 os << tag() << " \t " << message() << "\t StatusCode=" << code();
69 if ( !backTrace().empty() ) os << endmsg << "Exception stack trace\n" << backTrace();
70 return ( 0 != previous() ) ? previous()->printOut( os << endmsg ) : os;
71 }
GaudiException::previous
virtual GaudiException * previous() const
get the previous exception ( "previous" element in the linked list)
Definition: GaudiException.h:85
GaudiException::tag
virtual const std::string & tag() const
name tag for the exception, or exception type
Definition: GaudiException.h:67
GaudiException::message
virtual const std::string & message() const
error message to be printed
Definition: GaudiException.h:58
GaudiException::code
virtual const StatusCode & code() const
StatusCode for Exception.
Definition: GaudiException.h:76
GaudiException::backTrace
virtual const std::string & backTrace() const
return the stack trace at instantiation
Definition: GaudiException.h:88
GaudiException::printOut
virtual std::ostream & printOut(std::ostream &os=std::cerr) const
methods for overloaded printout to std::ostream& and MsgStream&
Definition: GaudiException.cpp:61
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:192

## ◆ setCode()

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

update the status code for the exception

Definition at line 79 of file GaudiException.h.

79 {
80 m_code = newStatus;
81 return code();
82 }
GaudiException::code
virtual const StatusCode & code() const
StatusCode for Exception.
Definition: GaudiException.h:76
GaudiException::m_code
StatusCode m_code
exception tag
Definition: GaudiException.h:105

## ◆ setMessage()

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

update the error message to be printed

Definition at line 61 of file GaudiException.h.

61 {
62 m_message = newMessage;
63 return message();
64 }
GaudiException::message
virtual const std::string & message() const
error message to be printed
Definition: GaudiException.h:58
GaudiException::m_message
std::string m_message
Definition: GaudiException.h:103

## ◆ setTag()

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

update name tag

Definition at line 70 of file GaudiException.h.

70 {
71 m_tag = newTag;
72 return tag();
73 }
GaudiException::tag
virtual const std::string & tag() const
name tag for the exception, or exception type
Definition: GaudiException.h:67
GaudiException::m_tag
std::string m_tag
error message
Definition: GaudiException.h:104

## ◆ tag()

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

name tag for the exception, or exception type

Definition at line 67 of file GaudiException.h.

67 { return m_tag; }
GaudiException::m_tag
std::string m_tag
error message
Definition: GaudiException.h:104

## ◆ what()

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

method from std::exception

Definition at line 100 of file GaudiException.h.

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

## Friends And Related Function Documentation

## ◆ StatusCode

friend class StatusCode
| friend

Definition at line 22 of file GaudiException.h.

## Member Data Documentation

## ◆ m_backTrace

std::string GaudiException::m_backTrace
| protected

status code for exception

Definition at line 106 of file GaudiException.h.

## ◆ m_code

StatusCode GaudiException::m_code
| protected

exception tag

Definition at line 105 of file GaudiException.h.

## ◆ m_message

std::string GaudiException::m_message
| protected

Definition at line 103 of file GaudiException.h.

## ◆ m_previous

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

stack trace at instantiation

Definition at line 107 of file GaudiException.h.

## ◆ m_tag

std::string GaudiException::m_tag
| protected

error message

Definition at line 104 of file GaudiException.h.

## ◆ s_proc

bool GaudiException::s_proc
| static protected

"previous" element in the linked list

Definition at line 108 of file GaudiException.h.

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

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