Loading [MathJax]/extensions/tex2jax.js
The Gaudi Framework  v31r0 (aeb156f0)
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
GaudiException.h
Go to the documentation of this file.
1 #ifndef GAUDIKERNEL_GAUDIEXCEPTION_H
2 #define GAUDIKERNEL_GAUDIEXCEPTION_H
3 
4 // Include files
5 #include "GaudiKernel/Kernel.h"
8 
9 #include <exception>
10 #include <iostream>
11 #include <string>
12 
21 class GAUDI_API GaudiException : virtual public std::exception {
22  friend class StatusCode;
23 
24 public:
31 
39 
47 
49  GaudiException( const GaudiException& Exception );
50 
52  virtual ~GaudiException() throw();
53 
55  GaudiException& operator=( const GaudiException& Exception );
56 
58  virtual const std::string& message() const { return m_message; }
59 
61  virtual const std::string& setMessage( const std::string& newMessage ) {
62  m_message = newMessage;
63  return message();
64  }
65 
67  virtual const std::string& tag() const { return m_tag; }
68 
70  virtual const std::string& setTag( const std::string& newTag ) {
71  m_tag = newTag;
72  return tag();
73  }
74 
76  virtual const StatusCode& code() const { return m_code; }
77 
79  virtual const StatusCode& setCode( const StatusCode& newStatus ) {
80  m_code = newStatus;
81  return code();
82  }
83 
85  virtual GaudiException* previous() const { return m_previous.get(); }
86 
88  virtual const std::string& backTrace() const { return m_backTrace; }
89 
91  virtual std::ostream& printOut( std::ostream& os = std::cerr ) const;
92 
94  virtual MsgStream& printOut( MsgStream& os ) const;
95 
97  virtual GaudiException* clone() const { return new GaudiException( *this ); }
98 
100  const char* what() const throw() override { return message().c_str(); }
101 
102 protected:
108  static bool s_proc;
109 };
110 
113 
116 
118 MsgStream& operator<<( MsgStream& os, const GaudiException& ge );
119 
121 MsgStream& operator<<( MsgStream& os, const GaudiException* pge );
122 
123 #endif // GAUDIKERNEL_GAUDIEXCEPTION_H
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
virtual const std::string & backTrace() const
return the stack trace at instantiation
Define general base for Gaudi exception.
virtual const StatusCode & setCode(const StatusCode &newStatus)
update the status code for the exception
code_t m_code
The status code value.
Definition: StatusCode.h:225
static bool s_proc
"previous" element in the linked list
virtual const std::string & setMessage(const std::string &newMessage)
update the error message to be printed
STL namespace.
std::ostream & operator<<(std::ostream &os, const GaudiException &ge)
overloaded printout to std::ostream
const char * what() const override
method from std::exception
std::string m_tag
error message
virtual const StatusCode & code() const
StatusCode for Exception.
STL class.
std::string m_message
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:50
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.
The Message class.
Definition: Message.h:17
std::string m_backTrace
status code for exception
virtual const std::string & setTag(const std::string &newTag)
update name tag
T c_str(T...args)
StatusCode m_code
exception tag
std::string message() const
Description (or name) of StatusCode value.
Definition: StatusCode.h:169
#define GAUDI_API
Definition: Kernel.h:71
STL class.
std::unique_ptr< GaudiException > m_previous
stack trace at instantiation