1 #ifndef GAUDIKERNEL_GAUDIEXCEPTION_H
2 #define GAUDIKERNEL_GAUDIEXCEPTION_H
5 #include "GaudiKernel/Kernel.h"
6 #include "GaudiKernel/StatusCode.h"
7 #include "GaudiKernel/MsgStream.h"
8 #include "GaudiKernel/System.h"
25 friend inline std::ostream&
operator<< ( std::ostream& os ,
27 friend inline std::ostream&
operator<< ( std::ostream& os ,
44 : m_message (
std::move(Message) )
45 , m_tag (
std::move(Tag) )
46 , m_code (
std::move(Code) )
59 : m_message (
std::move(Message) )
60 , m_tag (
std::move(Tag) )
61 , m_code (
std::move(Code) )
62 , m_previous ( Exception.clone() )
74 const std::exception& Exception )
75 : m_message (
std::move(Message) )
76 , m_tag (
std::move(Tag) )
77 , m_code (
std::move(Code) )
86 :
std::exception(Exception)
87 , m_message{ Exception.
message() }
88 , m_tag { Exception.
tag () }
89 , m_code { Exception.
code () }
103 m_message = Exception.
message() ;
104 m_tag = Exception.
tag () ;
105 m_code = Exception.
code () ;
111 virtual const std::string& message ()
const {
return m_message; }
114 virtual const std::string& setMessage(
const std::string& newMessage ) {
115 m_message = newMessage;
return message() ;
119 virtual const std::string& tag ()
const {
return m_tag; }
122 virtual const std::string& setTag (
const std::string& newTag ) {
123 m_tag = newTag ;
return tag() ;
127 virtual const StatusCode& code ()
const {
return m_code; }
131 m_code = newStatus;
return code() ;
135 virtual GaudiException* previous ()
const {
return m_previous.get() ; }
138 virtual std::ostream& printOut ( std::ostream& os = std::cerr )
const {
139 os << tag() <<
" \t " << message() ;
143 default : os <<
"\t StatusCode=" << code() ; break ;
145 return ( 0 != previous() ) ? previous()->printOut( os << std::endl ) : os ;
150 os << tag() <<
"\t" << message() ;
154 default : os <<
"\t StatusCode=" << code().getCode() ; break ;
156 return ( 0 != previous() ) ? previous()->printOut( os <<
endmsg ) : os ;
163 virtual const char* what ()
const throw() {
return message().c_str() ; }
165 mutable std::string m_message ;
166 mutable std::string m_tag ;
168 mutable std::unique_ptr<GaudiException> m_previous;
177 {
return (0 == pge) ?
178 ( os <<
" GaudiException* points to NULL!" ) : ( os << *pge ); }
187 ( os <<
" GaudiException* points to NULL!" ) : ( os << *pge );
190 #endif // GAUDIKERNEL_GAUDIEXCEPTION_H
virtual const std::string & message() const
error message to be printed
Definition of the MsgStream class used to transmit messages.
void setCode(unsigned long value)
Set the status code by value.
Define general base for Gaudi exception.
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
virtual const StatusCode & code() const
StatusCode for Exception.
std::ostream & operator<<(std::ostream &os, const GaudiException &ge)
overloaded printout to std::ostream
This class is used for returning status codes from appropriate routines.
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
virtual std::ostream & printOut(std::ostream &os=std::cerr) const
methods for overloaded printout to std::ostream& and MsgStream&
StatusCode & operator=(unsigned long value)
Assignment operator.