All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 (const std::string &Message, const std::string &Tag, const StatusCode &Code)
 Constructor (1) More...
 
 GaudiException (const std::string &Message, const std::string &Tag, const StatusCode &Code, const GaudiException &Exception)
 Constructor (2) More...
 
 GaudiException (const std::string &Message, const std::string &Tag, const 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::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 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::ostream & printOut (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...
 
virtual const char * what () const throw ()
 method from std::exception More...
 

Protected Attributes

std::string m_message
 
std::string m_tag
 error message More...
 
StatusCode m_code
 exception tag More...
 
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::ostream & operator<< (std::ostream &os, const GaudiException &ge)
 overloaded printout to std::ostream More...
 
std::ostream & operator<< (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 24 of file GaudiException.h.

Constructor & Destructor Documentation

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

Constructor (1)

Parameters
Messageerror message
Tag"name tag", or exeption type
Codestatus code

Definition at line 42 of file GaudiException.h.

45  : m_message ( Message )
46  , m_tag ( Tag )
47  , m_code ( Code )
48  , m_previous ( 0 )
49  { s_proc = true; }
static bool s_proc
"previous" element in the linked list
std::string m_tag
error message
std::string m_message
The Message class.
Definition: Message.h:15
GaudiException * m_previous
status code for exception
StatusCode m_code
exception tag
GaudiException::GaudiException ( const std::string &  Message,
const std::string &  Tag,
const 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 57 of file GaudiException.h.

61  : m_message ( Message )
62  , m_tag ( Tag )
63  , m_code ( Code )
64  , m_previous ( Exception.clone() )
65  {}
std::string m_tag
error message
std::string m_message
virtual GaudiException * clone() const
clone operation
The Message class.
Definition: Message.h:15
GaudiException * m_previous
status code for exception
StatusCode m_code
exception tag
GaudiException::GaudiException ( const std::string &  Message,
const std::string &  Tag,
const 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 73 of file GaudiException.h.

77  : m_message ( Message )
78  , m_tag ( Tag )
79  , m_code ( Code )
80  , m_previous ( 0 )
81  {
82  s_proc = true;
83  m_message += ": " + System::typeinfoName(typeid(Exception)) + ", " +
84  Exception.what();
85  }
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
Definition: System.cpp:298
static bool s_proc
"previous" element in the linked list
std::string m_tag
error message
std::string m_message
The Message class.
Definition: Message.h:15
GaudiException * m_previous
status code for exception
StatusCode m_code
exception tag
GaudiException::GaudiException ( const GaudiException Exception)
inline

Copy constructor (deep copying!)

Definition at line 88 of file GaudiException.h.

88  : std::exception(Exception)
89  {
90  s_proc = true;
91  m_message = Exception.message() ;
92  m_tag = Exception.tag () ;
93  m_code = Exception.code () ;
94  m_previous = ( 0 == Exception.previous() ) ?
95  0 : Exception.previous()->clone() ;
96  }
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
GaudiException * m_previous
status code for exception
StatusCode m_code
exception tag
virtual GaudiException::~GaudiException ( )
throw (
)
inlinevirtual

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

Definition at line 99 of file GaudiException.h.

99  {
100  m_code.setChecked();
101  if( 0 != m_previous ) { delete m_previous ; m_previous = 0 ; }
102  s_proc = false;
103  }
static bool s_proc
"previous" element in the linked list
GaudiException * m_previous
status code for exception
StatusCode m_code
exception tag
void setChecked() const
Ignore the checking code;.
Definition: StatusCode.h:91

Member Function Documentation

virtual GaudiException* GaudiException::clone ( ) const
inlinevirtual

clone operation

Reimplemented in UpdateManagerException.

Definition at line 167 of file GaudiException.h.

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

StatusCode for Exception.

Definition at line 134 of file GaudiException.h.

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

error message to be printed

Definition at line 118 of file GaudiException.h.

118 { return m_message; }
std::string m_message
GaudiException& GaudiException::operator= ( const GaudiException Exception)
inline

assignment operator

Definition at line 106 of file GaudiException.h.

106  {
107  if ( &Exception == this ) { return *this; }
108  m_message = Exception.message() ;
109  m_tag = Exception.tag () ;
110  m_code = Exception.code () ;
111  if( 0 != m_previous ) { delete m_previous; m_previous = 0 ; }
112  m_previous = ( 0 == Exception.previous() ) ?
113  0 : Exception.previous()->clone() ;
114  return *this;
115  }
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
GaudiException * m_previous
status code for exception
StatusCode m_code
exception tag
virtual GaudiException* GaudiException::previous ( ) const
inlinevirtual

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

Definition at line 142 of file GaudiException.h.

142 { return m_previous ; }
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 145 of file GaudiException.h.

145  {
146  os << tag() << " \t " << message() ;
147  switch( code() ) {
148  case StatusCode::SUCCESS : os << "\t StatusCode=SUCCESS" ; break ;
149  case StatusCode::FAILURE : os << "\t StatusCode=FAILURE" ; break ;
150  default : os << "\t StatusCode=" << code() ; break ;
151  }
152  return ( 0 != previous() ) ? previous()->printOut( os << std::endl ) : os ;
153  }
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&
virtual MsgStream& GaudiException::printOut ( MsgStream os) const
inlinevirtual

Output the exception to the Gaudi MsgStream.

Definition at line 156 of file GaudiException.h.

156  {
157  os << tag() << "\t" << message() ;
158  switch( code() ) {
159  case StatusCode::SUCCESS : os << "\t StatusCode=SUCCESS" ; break ;
160  case StatusCode::FAILURE : os << "\t StatusCode=FAILURE" ; break ;
161  default : os << "\t StatusCode=" << code().getCode() ; break ;
162  }
163  return ( 0 != previous() ) ? previous()->printOut( os << endmsg ) : os ;
164  }
virtual const std::string & message() const
error message to be printed
unsigned long getCode() const
Get the status code by value.
Definition: StatusCode.h:79
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:243
virtual const StatusCode& GaudiException::setCode ( const StatusCode newStatus)
inlinevirtual

update the status code for the exception

Definition at line 137 of file GaudiException.h.

137  {
138  m_code = newStatus; return code() ;
139  }
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 121 of file GaudiException.h.

121  {
122  m_message = newMessage; return message() ;
123  }
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 129 of file GaudiException.h.

129  {
130  m_tag = newTag ; return tag() ;
131  }
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 126 of file GaudiException.h.

126 { return m_tag; }
std::string m_tag
error message
virtual const char* GaudiException::what ( ) const
throw (
)
inlinevirtual

method from std::exception

Definition at line 170 of file GaudiException.h.

170 { return message().c_str() ; }
virtual const std::string & message() const
error message to be printed

Friends And Related Function Documentation

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

overloaded printout to std::ostream

Definition at line 180 of file GaudiException.h.

180  {
181  return ge.printOut( os );
182 }
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 183 of file GaudiException.h.

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

overloaded printout to MsgStream

Definition at line 188 of file GaudiException.h.

188  {
189  return ge.printOut( os );
190 }
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 192 of file GaudiException.h.

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

Definition at line 34 of file GaudiException.h.

Member Data Documentation

StatusCode GaudiException::m_code
mutableprotected

exception tag

Definition at line 174 of file GaudiException.h.

std::string GaudiException::m_message
mutableprotected

Definition at line 172 of file GaudiException.h.

GaudiException* GaudiException::m_previous
mutableprotected

status code for exception

Definition at line 175 of file GaudiException.h.

std::string GaudiException::m_tag
mutableprotected

error message

Definition at line 173 of file GaudiException.h.

bool GaudiException::s_proc
staticprotected

"previous" element in the linked list

Definition at line 176 of file GaudiException.h.


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