2 #ifndef GAUDIKERNEL_GAUDIEXCEPTION_H
3 #define GAUDIKERNEL_GAUDIEXCEPTION_H
26 friend inline std::ostream&
operator<< ( std::ostream& os ,
28 friend inline std::ostream&
operator<< ( std::ostream& os ,
43 const std::string& Tag,
45 : m_message ( Message )
58 const std::string& Tag ,
61 : m_message ( Message )
64 , m_previous ( Exception.clone() )
74 const std::string& Tag ,
76 const std::exception& Exception )
77 : m_message ( Message )
91 m_message = Exception.
message() ;
92 m_tag = Exception.
tag () ;
93 m_code = Exception.
code () ;
94 m_previous = ( 0 == Exception.
previous() ) ?
101 if( 0 != m_previous ) {
delete m_previous ; m_previous = 0 ; }
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() ) ?
118 virtual const std::string&
message ()
const {
return m_message; }
121 virtual const std::string&
setMessage(
const std::string& newMessage ) {
122 m_message = newMessage;
return message() ;
126 virtual const std::string&
tag ()
const {
return m_tag; }
129 virtual const std::string&
setTag (
const std::string& newTag ) {
130 m_tag = newTag ;
return tag() ;
138 m_code = newStatus;
return code() ;
145 virtual std::ostream&
printOut ( std::ostream& os = std::cerr )
const {
146 os << tag() <<
" \t " << message() ;
150 default : os <<
"\t StatusCode=" << code() ; break ;
152 return ( 0 != previous() ) ? previous()->printOut( os << std::endl ) : os ;
157 os << tag() <<
"\t" << message() ;
161 default : os <<
"\t StatusCode=" << code().getCode() ; break ;
163 return ( 0 != previous() ) ? previous()->printOut( os <<
endmsg ) : os ;
170 virtual const char*
what ()
const throw() {
return message().c_str() ; }
184 {
return (0 == pge) ?
185 ( os <<
" GaudiException* points to NULL!" ) : ( os << *pge ); }
194 ( os <<
" GaudiException* points to NULL!" ) : ( os << *pge );
197 #endif // GAUDIKERNEL_GAUDIEXCEPTION_H