| # Gaudi Framework, version v20r2
Generated: 18 Jul 2008

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

- Search for |

- Alphabetical List
- Class List
- Class Hierarchy
- Class Members

# GaudiException Class Reference

`#include <GaudiKernel/GaudiException.h>`

Inheritance diagram for GaudiException:

[legend]
Collaboration diagram for GaudiException:

[legend]
List of all members.

## Detailed Description

Define general base for Gaudi exception.

Author:
  Vanya Belyaev

  Sebastien Ponce

Definition at line 24 of file GaudiException.h.

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

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

Referenced by clone().

    00044     : m_message    ( Message    )
    00045     , m_tag        ( Tag        )
    00046     , m_code       ( Code       )
    00047     , m_previous   (     0      )
    00048     {}

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

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

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

References m_message, and System::typeinfoName().

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

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

Copy constructor (deep copying!).

Definition at line 86 of file GaudiException.h.

References clone(), code(), m_code, m_message, m_previous, m_tag, message(), previous(), and tag().

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

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

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

Definition at line 96 of file GaudiException.h.

References m_previous.

    00096                                     {
    00097     if( 0 != m_previous ) { delete m_previous ; m_previous = 0 ; }
    00098   }

## Member Function Documentation

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

assignment operator

Definition at line 101 of file GaudiException.h.

References clone(), code(), m_code, m_message, m_previous, m_tag, message(), previous(), and tag().

    00101                                                                {
    00102     if ( &Exception == this ) { return *this; }
    00103     m_message  =   Exception.message() ;
    00104     m_tag      =   Exception.tag    () ;
    00105     m_code     =   Exception.code   () ;
    00106     if( 0 != m_previous ) { delete m_previous; m_previous = 0 ; }
    00107     m_previous = ( 0 == Exception.previous() ) ?
    00108       0 : Exception.previous()->clone() ;
    00109     return *this;
    00110   }

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

error message to be printed

Definition at line 113 of file GaudiException.h.

References m_message.

Referenced by GaudiException(), operator=(), printOut(), setMessage(), and what().

    00113 { 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 116 of file GaudiException.h.

References m_message, and message().

    00116                                                                         {
    00117     m_message = newMessage; return message() ;
    00118   }

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

name tag for the exception, or exception type

Definition at line 121 of file GaudiException.h.

References m_tag.

Referenced by ToolSvc::create(), MinimalEventLoopMgr::executeEvent(), ToolSvc::finalizeTool(), IncidentSvc::fireIncident(), GaudiException(), operator=(), printOut(), setTag(), Algorithm::sysBeginRun(), Algorithm::sysEndRun(), Algorithm::sysExecute(), Auditor::sysFinalize(), AlgTool::sysFinalize(), Algorithm::sysFinalize(), Service::sysInitialize(), Auditor::sysInitialize(), AlgTool::sysInitialize(), Algorithm::sysInitialize(), Service::sysReinitialize(), AlgTool::sysReinitialize(), Algorithm::sysReinitialize(), Service::sysRestart(), AlgTool::sysRestart(), Algorithm::sysRestart(), Service::sysStart(), AlgTool::sysStart(), Algorithm::sysStart(), Service::sysStop(), AlgTool::sysStop(), and Algorithm::sysStop().

    00121 { return m_tag; }

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

update name tag

Definition at line 124 of file GaudiException.h.

References m_tag, and tag().

    00124                                                                         {
    00125     m_tag = newTag ; return tag() ;
    00126   }

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

StatusCode for Exception.

Definition at line 129 of file GaudiException.h.

References m_code.

Referenced by GaudiException(), ExceptionSvc::handle(), operator=(), printOut(), setCode(), and Algorithm::sysExecute().

    00129 { return m_code; }

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

update the status code for the exception

Definition at line 132 of file GaudiException.h.

References code(), and m_code.

    00132                                                                            {
    00133     m_code = newStatus; return code() ;
    00134   }

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

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

Definition at line 137 of file GaudiException.h.

References m_previous.

Referenced by GaudiException(), operator=(), and printOut().

    00137 { 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 140 of file GaudiException.h.

References code(), std::endl(), StatusCode::FAILURE, message(), previous(), printOut(), StatusCode::SUCCESS, and tag().

Referenced by operator<<(), and printOut().

    00140                                                                    {
    00141     os << tag() << " \t " << message() ;
    00142     switch( code() ) {
    00143       case StatusCode::SUCCESS : os << "\t StatusCode=SUCCESS"    ;  break ;
    00144       case StatusCode::FAILURE : os << "\t StatusCode=FAILURE"    ;  break ;
    00145       default                  : os << "\t StatusCode=" << code() ;  break ;
    00146     }
    00147     return ( 0 != previous() ) ? previous()->printOut( os << std::endl ) : os ;
    00148   };

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

Output the exception to the Gaudi MsgStream.

Definition at line 151 of file GaudiException.h.

References code(), endreq(), StatusCode::FAILURE, StatusCode::getCode(), message(), previous(), printOut(), StatusCode::SUCCESS, and tag().

    00151                                                       {
    00152     os << tag() << "\t" << message() ;
    00153     switch( code() ) {
    00154             case StatusCode::SUCCESS : os << "\t StatusCode=SUCCESS"    ;  break ;
    00155             case StatusCode::FAILURE : os << "\t StatusCode=FAILURE"    ;  break ;
    00156             default                  : os << "\t StatusCode=" << code().getCode() ;  break ;
    00157     }
    00158     return ( 0 != previous() ) ? previous()->printOut( os << endreq ) : os ;
    00159   }

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

clone operation

Reimplemented in TimeException, and UpdateManagerException.

Definition at line 162 of file GaudiException.h.

References GaudiException().

Referenced by GaudiException(), and operator=().

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

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

method from std::exception

Reimplemented from std::exception.

Definition at line 165 of file GaudiException.h.

References std::basic_string< _CharT, _Traits, _Alloc >::c_str(), and message().

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

## Friends And Related Function Documentation

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

overloaded printout to std::ostream

Definition at line 174 of file GaudiException.h.

    00174                                                                        {
    00175   return ge.printOut( os );
    00176 }

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

Definition at line 177 of file GaudiException.h.

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

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

overloaded printout to MsgStream

Definition at line 182 of file GaudiException.h.

    00182                                                                            {
    00183   return ge.printOut( os );
    00184 }

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

overloaded printout to MsgStream

Definition at line 186 of file GaudiException.h.

    00186                                                                            {
    00187   return (0 == pge) ?
    00188     ( os << " GaudiException* points to NULL!" ) : ( os << *pge );
    00189 }

## Member Data Documentation

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

Definition at line 167 of file GaudiException.h.

Referenced by GaudiException(), message(), operator=(), and setMessage().

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

error message

Definition at line 168 of file GaudiException.h.

Referenced by GaudiException(), operator=(), setTag(), and tag().

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

exception tag

Definition at line 169 of file GaudiException.h.

Referenced by code(), GaudiException(), operator=(), and setCode().

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

status code for exception

Definition at line 170 of file GaudiException.h.

Referenced by GaudiException(), operator=(), previous(), and ~GaudiException().

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

- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v20r2/GaudiKernel/v25r2/GaudiKernel/GaudiException.h