X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fexceptions.h;h=10231f59acaf24571c890361ec15f8094d33e3c6;hb=69a84c50d0e1196c3a83883173e4a301ff550364;hp=d0ba1f068ed23e3f62e3387a3f82dd1fa03df1a7;hpb=38e89b25f6042d7a9dc023bbdeff98b09cbdd26f;p=dcpomatic.git diff --git a/src/lib/exceptions.h b/src/lib/exceptions.h index d0ba1f068..10231f59a 100644 --- a/src/lib/exceptions.h +++ b/src/lib/exceptions.h @@ -253,9 +253,19 @@ public: class NetworkError : public std::runtime_error { public: - explicit NetworkError (std::string s) - : std::runtime_error (s) - {} + explicit NetworkError (std::string s, boost::optional d = boost::optional()); + + std::string summary () const { + return _summary; + } + + boost::optional detail () const { + return _detail; + } + +private: + std::string _summary; + boost::optional _detail; }; @@ -325,6 +335,15 @@ public: }; +class CPLNotFoundError : public DCPError +{ +public: + CPLNotFoundError(std::string id) + : DCPError(String::compose("CPL %1 not found", id)) + {} +}; + + class InvalidSignerError : public std::runtime_error { public: @@ -332,8 +351,8 @@ public: explicit InvalidSignerError (std::string reason); }; -class ProgrammingError : public std::runtime_error +class ProgrammingError : public std::runtime_error { public: ProgrammingError (std::string file, int line, std::string message = ""); @@ -378,6 +397,7 @@ class GLError : public std::runtime_error { public: GLError (char const* last, int e); + GLError (char const* message); }; @@ -387,25 +407,30 @@ public: class CopyError : public std::runtime_error { public: - CopyError (std::string s, boost::optional n = boost::optional()); + CopyError (std::string s, boost::optional ext4_error = boost::optional(), boost::optional platform_error = boost::optional()); virtual ~CopyError () throw () {} std::string message () const { return _message; } - boost::optional number () const { - return _number; + boost::optional ext4_number() const { + return _ext4_number; + } + + boost::optional platform_number() const { + return _platform_number; } private: std::string _message; - boost::optional _number; + boost::optional _ext4_number; + boost::optional _platform_number; }; /** @class CommunicationFailedError - * @brief Communcation between dcpomatic2_disk and _disk_writer failed somehow. + * @brief Communication between dcpomatic2_disk and _disk_writer failed somehow. */ class CommunicationFailedError : public CopyError { @@ -441,8 +466,17 @@ class PrivilegeError : public std::runtime_error { public: explicit PrivilegeError (std::string s) - : std::runtime_error (s) - {} + : std::runtime_error (s) + {} +}; + + +class MissingConfigurationError : public std::runtime_error +{ +public: + explicit MissingConfigurationError(std::string s) + : std::runtime_error(s) + {} };