| # Gaudi Framework, version v21r11 |

Home |  | Generated: 30 Sep 2010

# GaudiException Class Reference

Define general base for Gaudi exception. More...

`#include <GaudiKernel/GaudiException.h>`

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

List of all members.

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

## 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:

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

Definition at line 42 of file GaudiException.h.

    00045     : m_message    ( Message    )
    00046     , m_tag        ( Tag        )
    00047     , m_code       ( Code       )
    00048     , m_previous   (     0      )
    00049     { s_proc = true; }

GaudiException::GaudiException | ( | const std::string & | Message,
|  | const std::string & | Tag,
|  | const 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 57 of file GaudiException.h.

    00061     : m_message    ( Message            )
    00062     , m_tag        ( Tag                )
    00063     , m_code       ( Code               )
    00064     , m_previous   ( Exception.clone()  )
    00065     {}

GaudiException::GaudiException | ( | const std::string & | Message,
|  | const std::string & | Tag,
|  | const 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 73 of file GaudiException.h.

    00077     : m_message    ( Message    )
    00078     , m_tag        ( Tag        )
    00079     , m_code       ( Code       )
    00080     , m_previous   (     0      )
    00081     {
    00082       s_proc = true;
    00083       m_message += ": " + System::typeinfoName(typeid(Exception)) + ", " +
    00084                    Exception.what();
    00085     }

GaudiException::GaudiException | ( | const GaudiException & | Exception | ) | `[inline]`

Copy constructor (deep copying!).

Definition at line 88 of file GaudiException.h.

    00088                                                     : std::exception(Exception)
    00089   {
    00090     s_proc     = true;
    00091     m_message  =   Exception.message() ;
    00092     m_tag      =   Exception.tag    () ;
    00093     m_code     =   Exception.code   () ;
    00094     m_previous = ( 0 == Exception.previous() ) ?
    00095       0 : Exception.previous()->clone() ;
    00096   }

virtual GaudiException::~GaudiException | ( |  | ) | throw ()`[inline, virtual]`

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

Definition at line 99 of file GaudiException.h.

    00099                                     {
    00100     m_code.setChecked();
    00101     if( 0 != m_previous ) { delete m_previous ; m_previous = 0 ; }
    00102     s_proc = false;
    00103   }

## Member Function Documentation

GaudiException& GaudiException::operator= | ( | const GaudiException & | Exception | ) | `[inline]`

assignment operator

Definition at line 106 of file GaudiException.h.

    00106                                                                {
    00107     if ( &Exception == this ) { return *this; }
    00108     m_message  =   Exception.message() ;
    00109     m_tag      =   Exception.tag    () ;
    00110     m_code     =   Exception.code   () ;
    00111     if( 0 != m_previous ) { delete m_previous; m_previous = 0 ; }
    00112     m_previous = ( 0 == Exception.previous() ) ?
    00113       0 : Exception.previous()->clone() ;
    00114     return *this;
    00115   }

virtual const std::string& GaudiException::message | ( |  | ) | const`[inline, virtual]`

error message to be printed

Definition at line 118 of file GaudiException.h.

    00118 { return m_message; }

virtual const std::string& GaudiException::setMessage | ( | const std::string & | newMessage | ) | `[inline, virtual]`

update the error message to be printed

Definition at line 121 of file GaudiException.h.

    00121                                                                         {
    00122     m_message = newMessage; return message() ;
    00123   }

virtual const std::string& GaudiException::tag | ( |  | ) | const`[inline, virtual]`

name tag for the exception, or exception type

Definition at line 126 of file GaudiException.h.

    00126 { return m_tag; }

virtual const std::string& GaudiException::setTag | ( | const std::string & | newTag | ) | `[inline, virtual]`

update name tag

Definition at line 129 of file GaudiException.h.

    00129                                                                         {
    00130     m_tag = newTag ; return tag() ;
    00131   }

virtual const StatusCode& GaudiException::code | ( |  | ) | const`[inline, virtual]`

StatusCode for Exception.

Definition at line 134 of file GaudiException.h.

    00134 { return m_code; }

virtual const StatusCode& GaudiException::setCode | ( | const StatusCode & | newStatus | ) | `[inline, virtual]`

update the status code for the exception

Definition at line 137 of file GaudiException.h.

    00137                                                                            {
    00138     m_code = newStatus; return code() ;
    00139   }

virtual GaudiException* GaudiException::previous | ( |  | ) | const`[inline, virtual]`

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

Definition at line 142 of file GaudiException.h.

    00142 { return m_previous ; }

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 145 of file GaudiException.h.

    00145                                                                    {
    00146     os << tag() << " \t " << message() ;
    00147     switch( code() ) {
    00148       case StatusCode::SUCCESS : os << "\t StatusCode=SUCCESS"    ;  break ;
    00149       case StatusCode::FAILURE : os << "\t StatusCode=FAILURE"    ;  break ;
    00150       default                  : os << "\t StatusCode=" << code() ;  break ;
    00151     }
    00152     return ( 0 != previous() ) ? previous()->printOut( os << std::endl ) : os ;
    00153   };

virtual MsgStream& GaudiException::printOut | ( | MsgStream & | os | ) | const`[inline, virtual]`

Output the exception to the Gaudi MsgStream.

Definition at line 156 of file GaudiException.h.

    00156                                                       {
    00157     os << tag() << "\t" << message() ;
    00158     switch( code() ) {
    00159             case StatusCode::SUCCESS : os << "\t StatusCode=SUCCESS"    ;  break ;
    00160             case StatusCode::FAILURE : os << "\t StatusCode=FAILURE"    ;  break ;
    00161             default                  : os << "\t StatusCode=" << code().getCode() ;  break ;
    00162     }
    00163     return ( 0 != previous() ) ? previous()->printOut( os << endmsg ) : os ;
    00164   }

virtual GaudiException* GaudiException::clone | ( |  | ) | const`[inline, virtual]`

clone operation

Reimplemented in UpdateManagerException.

Definition at line 167 of file GaudiException.h.

    00167 { return new GaudiException(*this); };

virtual const char* GaudiException::what | ( |  | ) | const throw ()`[inline, virtual]`

method from std::exception

Reimplemented from std::exception.

Definition at line 170 of file GaudiException.h.

    00170 { return message().c_str() ; }

## Friends And Related Function Documentation

friend class StatusCode`[friend]`

Definition at line 34 of file GaudiException.h.

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

overloaded printout to std::ostream

Definition at line 180 of file GaudiException.h.

    00180                                                                        {
    00181   return ge.printOut( os );
    00182 }

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

Definition at line 183 of file GaudiException.h.

    00184 { return (0 == pge) ?
    00185     ( 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.

    00188                                                                            {
    00189   return ge.printOut( os );
    00190 }

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

overloaded printout to MsgStream

Definition at line 192 of file GaudiException.h.

    00192                                                                            {
    00193   return (0 == pge) ?
    00194     ( os << " GaudiException* points to NULL!" ) : ( os << *pge );
    00195 }

## Member Data Documentation

std::string GaudiException::m_message`[mutable, protected]`

Definition at line 172 of file GaudiException.h.

std::string GaudiException::m_tag`[mutable, protected]`

error message

Definition at line 173 of file GaudiException.h.

StatusCode GaudiException::m_code`[mutable, protected]`

exception tag

Definition at line 174 of file GaudiException.h.

GaudiException* GaudiException::m_previous`[mutable, protected]`

status code for exception

Definition at line 175 of file GaudiException.h.

bool GaudiException::s_proc`[static, protected]`

"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:

- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v21r11/GaudiKernel/GaudiKernel/GaudiException.h
- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v21r11/GaudiKernel/src/Lib/GaudiException.cpp