![]() |
|
|
Generated: 8 Jan 2009 |
00001 // $Id: GslErrorHandlers.cpp,v 1.1 2003/11/19 16:55:59 mato Exp $ 00002 // ============================================================================ 00003 // 00004 // ============================================================================ 00005 // Include files 00006 // GaudiKernel 00007 #include "GaudiKernel/GaudiException.h" 00008 // GaudiGSL 00009 #include "GaudiGSL/IGslSvc.h" 00010 #include "GaudiGSL/GslError.h" 00011 // local 00012 #include "GaudiGSL/GslErrorHandlers.h" 00013 #include "GaudiGSL/GaudiGSL.h" 00014 00039 void GslErrorHandlers::ignoreTheError 00040 ( const char* /* reason */ , 00041 const char* /* file */ , 00042 int /* line */ , 00043 int /* code */ ) 00044 {}; 00045 00062 void GslErrorHandlers::handleTheError 00063 ( const char* reason , 00064 const char* file , 00065 int line , 00066 int code ) 00067 { 00068 // het the GSL service 00069 const IGslSvc* svc = GaudiGSL::gslSvc() ; 00070 // handle the error if service is valid 00071 if( 0 != svc ) { svc->handle( GslError( reason , file , line , code ) ) ; } 00072 }; 00073 00090 void GslErrorHandlers::throwException 00091 ( const char* reason , 00092 const char* file , 00093 int line , 00094 int code ) 00095 { 00096 std::string error( " GSL ErrorCode=" ); 00097 static char s_aux[512]; 00098 error += std::string( s_aux , s_aux + sprintf( s_aux , "%d" , code ) ); 00099 error += ": '" ; 00100 error += reason ; 00101 error += "' in the file '" ; 00102 error += file ; 00103 error += "' at the line " ; 00104 error += std::string( s_aux , s_aux + sprintf( s_aux , "%d" , line ) ); 00105 error += "'" ; 00106 throw GaudiException( error , "*GLS Error*" , StatusCode::FAILURE ); 00107 }; 00108 00109 // ============================================================================ 00110 // The END 00111 // ============================================================================