X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fexceptions.h;h=96dc816ec4dea27cbbc94937dbf98a0c76c2fe6b;hb=a112eeb4d052b1212f94e95efd83a215213da691;hp=38452ffc02b7c0867596cb55787a77c29eeafc01;hpb=3574212ee42b2bd924eb95d5c0f4f69ec9e0a2f0;p=dcpomatic.git diff --git a/src/lib/exceptions.h b/src/lib/exceptions.h index 38452ffc0..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 () {} @@ -245,10 +245,30 @@ public: SubRipError (std::string, std::string, boost::filesystem::path); }; +class DCPError : public StringError +{ +public: + DCPError (std::string s) + : StringError (s) + {} +}; + +class InvalidSignerError : public StringError +{ +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. - + * * This is intended for classes which run their own thread; they should do * something like * @@ -270,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); } } @@ -287,6 +308,4 @@ private: mutable boost::mutex _mutex; }; - - #endif