TuttleOFX
1
|
00001 #ifndef _OFXH_EXCEPTION_HPP_ 00002 #define _OFXH_EXCEPTION_HPP_ 00003 00004 #include "OfxhCore.hpp" 00005 #include "OfxhUtilities.hpp" 00006 00007 #include <tuttle/host/exceptions.hpp> 00008 00009 #include <boost/throw_exception.hpp> 00010 #include <boost/exception/exception.hpp> 00011 00012 #include <stdexcept> 00013 00014 namespace tuttle { 00015 namespace host { 00016 namespace ofx { 00017 00018 /** 00019 * exception, representing an OfxStatus 00020 */ 00021 class OfxhException : virtual public ::std::exception 00022 , virtual public ::boost::exception 00023 , virtual public ::boost::backtrace 00024 { 00025 OfxStatus _stat; 00026 00027 public: 00028 explicit OfxhException( const std::string& what ) 00029 : ::boost::exception() 00030 { 00031 *this << ::tuttle::exception::dev() + what; 00032 } 00033 00034 explicit OfxhException( OfxStatus stat ) 00035 : ::boost::exception() 00036 , _stat( stat ) 00037 { 00038 *this << ::tuttle::exception::ofxStatus(stat); 00039 } 00040 00041 explicit OfxhException( OfxStatus stat, const std::string& what ) 00042 : ::boost::exception() 00043 , _stat( stat ) 00044 { 00045 *this << ::tuttle::exception::ofxStatus(stat); 00046 *this << ::tuttle::exception::dev() + what; 00047 } 00048 00049 /// get the status 00050 OfxStatus getStatus() const 00051 { 00052 return _stat; 00053 } 00054 00055 ///@todo tuttle : mapStatusEnumToStr... in tuttle common 00056 std::string getStatusStr() const 00057 { 00058 return ofx::mapStatusToString( _stat ); 00059 } 00060 00061 }; 00062 00063 //#if !defined(WINDOWS) || !defined(SWIG) 00064 // #define OFX_EXCEPTION_SPEC throw(tuttle::host::ofx::OfxhException) 00065 //#else 00066 #define OFX_EXCEPTION_SPEC 00067 //#endif 00068 00069 } 00070 } 00071 } 00072 00073 #endif 00074