47 #define POTHOS_EXCEPTION_TRY try{try
55 #define POTHOS_EXCEPTION_CATCH(catchExpr) \
56 catch(const Pothos::Exception &){throw;}\
57 catch(const Poco::Exception &ex){throw Pothos::Exception(ex.displayText());}\
58 catch(const std::exception &ex){throw Pothos::Exception(ex.what());}\
59 catch(...){throw Pothos::Exception("unknown exception");}\
70 Exception(
const std::string& msg,
int code = 0);
73 Exception(
const std::string& msg,
const std::string& arg,
int code = 0);
89 virtual const char* name()
const throw();
92 virtual const char* className()
const throw();
95 virtual const char* what()
const throw();
104 const std::string& message()
const;
110 std::string displayText()
const;
120 virtual void rethrow()
const;
131 void message(
const std::string& msg);
134 void extendedMessage(
const std::string& arg);
177 #define POTHOS_DECLARE_EXCEPTION_CODE(API, CLS, BASE, CODE) \
178 class API CLS: public BASE \
181 CLS(int code = CODE); \
182 CLS(const std::string& msg, int code = CODE); \
183 CLS(const std::string& msg, const std::string& arg, int code = CODE); \
184 CLS(const std::string& msg, const Pothos::Exception& exc, int code = CODE); \
185 CLS(const CLS& exc); \
187 CLS& operator = (const CLS& exc); \
188 const char* name() const throw(); \
189 const char* className() const throw(); \
190 Pothos::Exception* clone() const; \
191 void rethrow() const; \
194 #define POTHOS_DECLARE_EXCEPTION(API, CLS, BASE) \
195 POTHOS_DECLARE_EXCEPTION_CODE(API, CLS, BASE, 0)
197 #define POTHOS_IMPLEMENT_EXCEPTION(CLS, BASE, NAME) \
198 CLS::CLS(int code): BASE(code) \
201 CLS::CLS(const std::string& msg, int code): BASE(msg, code) \
204 CLS::CLS(const std::string& msg, const std::string& arg, int code): BASE(msg, arg, code) \
207 CLS::CLS(const std::string& msg, const Pothos::Exception& exc, int code): BASE(msg, exc, code) \
210 CLS::CLS(const CLS& exc): BASE(exc) \
213 CLS::~CLS() throw() \
216 CLS& CLS::operator = (const CLS& exc) \
218 BASE::operator = (exc); \
221 const char* CLS::name() const throw() \
225 const char* CLS::className() const throw() \
227 return typeid(*this).name(); \
229 Pothos::Exception* CLS::clone() const \
231 return new CLS(*this); \
233 void CLS::rethrow() const \
Definition: Exception.hpp:286
Definition: Exception.hpp:251
Definition: Exception.hpp:277
POTHOS_DECLARE_EXCEPTION(POTHOS_API, ObjectConvertError, RuntimeException)
Definition: Exception.hpp:253
Definition: Exception.hpp:246
const std::string & message() const
Definition: Exception.hpp:153
Definition: Exception.hpp:282
Definition: Exception.hpp:256
Definition: Exception.hpp:279
#define POTHOS_API
Definition: Config.hpp:41
Definition: Exception.hpp:276
Definition: Exception.hpp:258
Definition: Exception.hpp:285
Definition: Exception.hpp:247
Definition: Exception.hpp:267
Definition: Exception.hpp:243
Definition: Exception.hpp:284
Definition: Exception.hpp:275
Definition: Exception.hpp:283
Definition: Exception.hpp:262
Definition: Exception.hpp:245
Definition: Exception.hpp:268
Definition: Exception.hpp:266
Definition: Exception.hpp:248
Definition: Exception.hpp:249
Definition: Exception.hpp:274
const Exception * nested() const
Definition: Exception.hpp:147
Definition: Exception.hpp:278
int code() const
Returns the message text.
Definition: Exception.hpp:165
Definition: Exception.hpp:242
Definition: Exception.hpp:265
Definition: Exception.hpp:244
Definition: Exception.hpp:257
Definition: Exception.hpp:259
Definition: Exception.hpp:281
Definition: Exception.hpp:260
Definition: Exception.hpp:255
Definition: Exception.hpp:261
Definition: Exception.hpp:271
Definition: Exception.hpp:288
Definition: Exception.hpp:280
Definition: Exception.hpp:252
Definition: Exception.hpp:250
Definition: Exception.hpp:65
Definition: Exception.hpp:273
Definition: Exception.hpp:272
Definition: Exception.hpp:264
Definition: Exception.hpp:289
Definition: Exception.hpp:263