|
Gaudi Framework, version v23r2 |
| Home | Generated: Thu Jun 28 2012 |
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 #include <sstream> 00012 // local 00013 #include "GslErrorException.h" 00014 00015 // ============================================================================ 00023 // ============================================================================ 00024 00025 // ============================================================================ 00031 // ============================================================================ 00032 00033 // ============================================================================ 00039 // ============================================================================ 00040 GslErrorException::GslErrorException 00041 ( const std::string& type , 00042 const std::string& name , 00043 const IInterface* parent ) 00044 : base_class ( type, name , parent ) 00045 , m_ignore () 00046 { 00047 declareProperty ( "IgnoreCodes" , m_ignore ); 00048 } 00049 // ============================================================================ 00050 00051 // ============================================================================ 00053 // ============================================================================ 00054 GslErrorException::~GslErrorException(){} 00055 // ============================================================================ 00056 00057 // ============================================================================ 00064 // ============================================================================ 00065 StatusCode GslErrorException::handle 00066 ( const GslError& error ) const 00067 { 00068 StatusCode sc = StatusCode::SUCCESS ; 00069 // code to be ignored? 00070 if( m_ignore.end() != std::find( m_ignore.begin () , 00071 m_ignore.end () , 00072 error.code ) ) { return sc ; } 00073 // 00074 std::ostringstream message; 00075 message << " GSL ErrorCode=" 00076 << error.code << ": '" << error.reason << "' in the file '" 00077 << error.file << "' at the line " << error.line; 00078 throw GaudiException( message.str() , "*GLS Error*" , StatusCode::FAILURE ); 00080 return StatusCode::SUCCESS ; 00081 } 00082 // ============================================================================ 00083 00084 DECLARE_TOOL_FACTORY(GslErrorException) 00085 00086 // ============================================================================ 00087 // The END 00088 // ============================================================================