|
Gaudi Framework, version v22r1 |
| Home | Generated: Mon Feb 28 2011 |
00001 // $Id: GslErrorException.cpp,v 1.2 2006/01/10 20:00:05 hmd Exp $ 00002 // ============================================================================ 00003 // ============================================================================ 00004 // Include files 00005 // from Gaudi 00006 #include "GaudiKernel/ToolFactory.h" 00007 #include "GaudiKernel/MsgStream.h" 00008 #include "GaudiKernel/GaudiException.h" 00009 // STD & STL 00010 #include <algorithm> 00011 // local 00012 #include "GslErrorException.h" 00013 00014 // ============================================================================ 00022 // ============================================================================ 00023 00024 // ============================================================================ 00030 // ============================================================================ 00031 DECLARE_TOOL_FACTORY(GslErrorException) 00032 // ============================================================================ 00033 00034 // ============================================================================ 00040 // ============================================================================ 00041 GslErrorException::GslErrorException 00042 ( const std::string& type , 00043 const std::string& name , 00044 const IInterface* parent ) 00045 : base_class ( type, name , parent ) 00046 , m_ignore () 00047 { 00048 declareProperty ( "IgnoreCodes" , m_ignore ); 00049 } 00050 // ============================================================================ 00051 00052 // ============================================================================ 00054 // ============================================================================ 00055 GslErrorException::~GslErrorException(){} 00056 // ============================================================================ 00057 00058 // ============================================================================ 00065 // ============================================================================ 00066 StatusCode GslErrorException::handle 00067 ( const GslError& error ) const 00068 { 00069 StatusCode sc = StatusCode::SUCCESS ; 00070 // code to be ignored? 00071 if( m_ignore.end() != std::find( m_ignore.begin () , 00072 m_ignore.end () , 00073 error.code ) ) { return sc ; } 00074 // 00075 std::string message( " GSL ErrorCode=" ); 00076 static char s_aux[512]; 00077 message += 00078 std::string( s_aux , s_aux + sprintf( s_aux , "%d" , error.code ) ); 00079 message += ": '" ; 00080 message += error.reason ; 00081 message += "' in the file '" ; 00082 message += error.file ; 00083 message += "' at the line " ; 00084 message += 00085 std::string( s_aux , s_aux + sprintf( s_aux , "%d" , error.line ) ); 00086 message += "'" ; 00087 throw GaudiException( message , "*GLS Error*" , StatusCode::FAILURE ); 00089 return StatusCode::SUCCESS ; 00090 } 00091 // ============================================================================ 00092 00093 00094 // ============================================================================ 00095 // The END 00096 // ============================================================================