00001
00003
00017
00018 #ifndef GIGA_GIGAEXCEPTION_H
00019 #define GIGA_GIGAEXCEPTION_H 1
00020
00021
00022
00023
00024 #include "GaudiKernel/GaudiException.h"
00025
00033 class GiGaException : public GaudiException
00034 {
00035 public:
00036
00041 GiGaException( const std::string & message ,
00042 const StatusCode & sc = StatusCode::FAILURE ) ;
00043
00049 GiGaException( const std::string & message ,
00050 const GaudiException& Exception ,
00051 const StatusCode & sc = StatusCode::FAILURE ) ;
00052
00054 virtual ~GiGaException() throw();
00055
00057 virtual GaudiException* clone() const;
00058
00059 };
00060
00061
00063
00064
00065 #define ___GIGA_TRY___ try
00066
00067 #define ___GIGA_THROW_GIGA____(_tag,_method,_exception) \
00068 { std::string _str(_tag); \
00069 _str += " GiGaException is catched "; \
00070 if(!( '\0' == _method[0] || (' ' == _method[0] && '\0' == _method[1]))) \
00071 { _str += " from " ; _str += _method ; } \
00072 throw GiGaException( _str, _exception ); }
00073
00074 #define ___GIGA_THROW_GAUDI___(_tag,_method,_exception) \
00075 { std::string _str(_tag); \
00076 _str += " GaudiException with tag="; \
00077 _str += _exception.tag(); \
00078 _str += " is catched "; \
00079 if(!( '\0' == _method[0] || (' ' == _method[0] && '\0' == _method[1]))) \
00080 { _str += " from " ; _str += _method ; } \
00081 throw GiGaException( _str, _exception ); }
00082
00083 #define ___GIGA_THROW_STD_____(_tag,_method,_exception) \
00084 { std::string _str(_tag); \
00085 _str += " std::exception with what="; \
00086 _str += _exception.what(); \
00087 _str += " is catched "; \
00088 if(!( '\0' == _method[0] || (' ' == _method[0] && '\0' == _method[1]))) \
00089 { _str += " from " ; _str += _method ; } \
00090 throw GiGaException( _str ); }
00091
00092 #define ___GIGA_THROW_ALL_____(_tag,_method) \
00093 { std::string _str(_tag); \
00094 _str += " UNKNOWN exception "; \
00095 _str += " is catched "; \
00096 if(!( '\0' == _method[0] || (' ' == _method[0] && '\0' == _method[1]))) \
00097 { _str += " from " ; _str += _method ; } \
00098 throw GiGaException( _str ); }
00099
00100
00101 #define ___GIGA_PRINT_GIGA____(_tag,_method,_ms,_ss,_ex) \
00102 { std::string _str(_tag); \
00103 _str += " GiGaException is catched "; \
00104 if(!( '\0' == _method[0] || (' ' == _method[0] && '\0' == _method[1]))) \
00105 { _str += " from " ; _str += _method ; } \
00106 MsgStream _log1( _ms , _tag ); \
00107 MsgStream _log2( _ms , _ex.tag() ); \
00108 _log1 << MSG::ERROR << _str << " : " << endreq; \
00109 _log2 << MSG::ERROR << _ex << endreq; \
00110 Stat _stat( _ss , _ex.tag() ); }
00111
00112 #define ___GIGA_PRINT_GAUDI___(_tag,_method,_ms,_ss,_ex) \
00113 { std::string _str(_tag); \
00114 _str += " GaudiException with tag="; \
00115 _str += _ex.tag(); \
00116 _str += "is catched "; \
00117 if(!( '\0' == _method[0] || (' ' == _method[0] && '\0' == _method[1]))) \
00118 { _str += " from " ; _str += _method ; } \
00119 MsgStream _log1( _ms , _tag ); \
00120 MsgStream _log2( _ms , _ex.tag() ); \
00121 _log1 << MSG::ERROR << _str << " : " << endreq; \
00122 _log2 << MSG::ERROR << _ex << endreq; \
00123 Stat _stat( _ss , _ex.tag() ); }
00124
00125 #define ___GIGA_PRINT_STD_____(_tag,_method,_ms,_ss,_ex) \
00126 { std::string _str(_tag); \
00127 _str += " std::exception with what="; \
00128 _str += _ex.what(); \
00129 _str += "is catched "; \
00130 if(!( '\0' == _method[0] || (' ' == _method[0] && '\0' == _method[1]))) \
00131 { _str += " from " ; _str += _method ; } \
00132 MsgStream _log1( _ms , _tag ); \
00133 MsgStream _log2( _ms , _ex.what() ); \
00134 _log1 << MSG::ERROR << _str << " : " << endreq; \
00135 _log2 << MSG::ERROR << "*std::exception* what=" \
00136 << _ex.what() << endreq; \
00137 Stat _stat( _ss , "*std::exception*" ); }
00138
00139 #define ___GIGA_PRINT_ALL_____(_tag,_method,_ms,_ss) \
00140 { std::string _str(_tag); \
00141 _str += " UNKNOWN exception "; \
00142 _str += "is catched "; \
00143 if(!( '\0' == _method[0] || (' ' == _method[0] && '\0' == _method[1]))) \
00144 { _str += " from " ; _str += _method ; } \
00145 MsgStream _log1( _ms , _tag ); \
00146 MsgStream _log2( _ms , "*UNKNOWN exception*" ); \
00147 _log1 << MSG::ERROR << _str << " : " << endreq; \
00148 _log2 << MSG::ERROR << "*UNKNOWN exception*" << endreq; \
00149 Stat _stat( _ss , "*UNKNOWN exception*" ); }
00150
00151 #define ___GIGA_CATCH_GIGA____(_body) catch( const GiGaException & _ex ) \
00152 { _body; }
00153
00154 #define ___GIGA_CATCH_GAUDI___(_body) catch( const GaudiException & _ex ) \
00155 { _body; }
00156
00157 #define ___GIGA_CATCH_STD_____(_body) catch( const std::exception & _ex ) \
00158 { _body; }
00159
00160 #define ___GIGA_CATCH_ALL_____(_body) catch(...){ _body; }
00161
00162
00163 #define ___GIGA_CATCH_AND_THROW_GIGA____(_tag,_method) \
00164 catch( const GiGaException & _ex ) \
00165 { ___GIGA_THROW_GIGA____(_tag,_method,_ex) ; }
00166
00167 #define ___GIGA_CATCH_AND_THROW_GAUDI___(_tag,_method) \
00168 catch( const GaudiException & _ex ) \
00169 { ___GIGA_THROW_GAUDI___(_tag,_method,_ex) ; }
00170
00171 #define ___GIGA_CATCH_AND_THROW_STD_____(_tag,_method) \
00172 catch( const std::exception & _ex ) \
00173 { ___GIGA_THROW_STD_____(_tag,_method,_ex) ; }
00174
00175 #define ___GIGA_CATCH_AND_THROW_ALL_____(_tag,_method) \
00176 catch(...) \
00177 { ___GIGA_THROW_ALL_____(_tag,_method) ; }
00178
00179
00180 #define ___GIGA_CATCH_AND_PRINT_GIGA____(_tag,_method,_ms,_ss) \
00181 catch( const GiGaException & _ex ) \
00182 { ___GIGA_PRINT_GIGA____(_tag,_method,_ms,_ss,_ex) ; }
00183
00184 #define ___GIGA_CATCH_AND_PRINT_GAUDI___(_tag,_method,_ms,_ss) \
00185 catch( const GaudiException & _ex ) \
00186 { ___GIGA_PRINT_GAUDI___(_tag,_method,_ms,_ss,_ex) ; }
00187
00188 #define ___GIGA_CATCH_AND_PRINT_STD_____(_tag,_method,_ms,_ss) \
00189 catch( const std::exception & _ex ) \
00190 { ___GIGA_PRINT_STD_____(_tag,_method,_ms,_ss,_ex) ; }
00191
00192 #define ___GIGA_CATCH_AND_PRINT_ALL_____(_tag,_method,_ms,_ss) \
00193 catch(...) \
00194 { ___GIGA_PRINT_ALL_____(_tag,_method,_ms,_ss) ; }
00195
00196
00197 #define ___GIGA_CATCH_PRINT_AND_RETURN_GIGA____(_tag,_method,_ms,_ss,_sc) \
00198 catch( const GiGaException & _ex ) \
00199 { ___GIGA_PRINT_GIGA____(_tag,_method,_ms,_ss,_ex) ; return _sc ; }
00200
00201 #define ___GIGA_CATCH_PRINT_AND_RETURN_GAUDI___(_tag,_method,_ms,_ss,_sc) \
00202 catch( const GaudiException & _ex ) \
00203 { ___GIGA_PRINT_GAUDI___(_tag,_method,_ms,_ss,_ex) ; return _sc ; }
00204
00205 #define ___GIGA_CATCH_PRINT_AND_RETURN_STD_____(_tag,_method,_ms,_ss,_sc) \
00206 catch( const std::exception & _ex ) \
00207 { ___GIGA_PRINT_STD_____(_tag,_method,_ms,_ss,_ex) ; return _sc ; }
00208
00209 #define ___GIGA_CATCH_PRINT_AND_RETURN_ALL_____(_tag,_method,_ms,_ss,_sc) \
00210 catch(...) \
00211 { ___GIGA_PRINT_ALL_____(_tag,_method,_ms,_ss) ; return _sc ; }
00212
00213
00214 #define ___GIGA_CATCH___(_body) \
00215 ___GIGA_CATCH_GIGA____(_body) \
00216 ___GIGA_CATCH_GAUDI___(_body) \
00217 ___GIGA_CATCH_STD_____(_body) \
00218 ___GIGA_CATCH_ALL_____(_body)
00219
00220 #define ___GIGA_CATCH_AND_RETURN___(_ret) \
00221 ___GIGA_CATCH____( return _ret )
00222
00223 #define ___GIGA_CATCH_AND_THROW___(_tag,_method) \
00224 ___GIGA_CATCH_AND_THROW_GIGA____(_tag,_method) \
00225 ___GIGA_CATCH_AND_THROW_GAUDI___(_tag,_method) \
00226 ___GIGA_CATCH_AND_THROW_STD_____(_tag,_method) \
00227 ___GIGA_CATCH_AND_THROW_ALL_____(_tag,_method)
00228
00229 #define ___GIGA_CATCH_AND_PRINT___(_tag,_method,_ms,_ss) \
00230 ___GIGA_CATCH_AND_PRINT_GIGA____(_tag,_method,_ms,_ss) \
00231 ___GIGA_CATCH_AND_PRINT_GAUDI___(_tag,_method,_ms,_ss) \
00232 ___GIGA_CATCH_AND_PRINT_STD_____(_tag,_method,_ms,_ss) \
00233 ___GIGA_CATCH_AND_PRINT_ALL_____(_tag,_method,_ms,_ss)
00234
00235 #define ___GIGA_CATCH_PRINT_AND_RETURN___(_tag,_method,_ms,_ss,_sc) \
00236 ___GIGA_CATCH_PRINT_AND_RETURN_GIGA____(_tag,_method,_ms,_ss,_sc) \
00237 ___GIGA_CATCH_PRINT_AND_RETURN_GAUDI___(_tag,_method,_ms,_ss,_sc) \
00238 ___GIGA_CATCH_PRINT_AND_RETURN_STD_____(_tag,_method,_ms,_ss,_sc) \
00239 ___GIGA_CATCH_PRINT_AND_RETURN_ALL_____(_tag,_method,_ms,_ss,_sc)
00240
00241
00242
00243 #endif // GIGA_GIGAEXCEPTION_H
00244