X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fexceptions.h;h=96dc816ec4dea27cbbc94937dbf98a0c76c2fe6b;hb=a112eeb4d052b1212f94e95efd83a215213da691;hp=52f257a8d3f558550ccba9724dfe612e3eca55c0;hpb=f4030653da8f5a0b3daebe640f485b3daf9ef091;p=dcpomatic.git diff --git a/src/lib/exceptions.h b/src/lib/exceptions.h index 52f257a8d..96dc816ec 100644 --- a/src/lib/exceptions.h +++ b/src/lib/exceptions.h @@ -24,14 +24,14 @@ #ifndef DCPOMATIC_EXCEPTIONS_H #define DCPOMATIC_EXCEPTIONS_H -#include -#include -#include -#include #include extern "C" { #include } +#include +#include +#include +#include /** @class StringError * @brief A parent class for exceptions using messages held in a std::string @@ -40,9 +40,9 @@ class StringError : public std::exception { public: /** @param w Error message */ - StringError (std::string w) { - _what = w; - } + StringError (std::string w) + : _what (w) + {} virtual ~StringError () throw () {} @@ -259,6 +259,12 @@ public: InvalidSignerError (); }; +class ProgrammingError : public StringError +{ +public: + ProgrammingError (std::string file, int line); +}; + /** @class ExceptionStore * @brief A parent class for classes which have a need to catch and * re-throw exceptions. @@ -284,8 +290,9 @@ public: void rethrow () { boost::mutex::scoped_lock lm (_mutex); if (_exception) { - boost::rethrow_exception (_exception); + boost::exception_ptr tmp = _exception; _exception = boost::exception_ptr (); + boost::rethrow_exception (tmp); } }