X-Git-Url: https://git.carlh.net/gitweb/?p=dcpomatic.git;a=blobdiff_plain;f=src%2Flib%2Fexceptions.h;h=80d4801daf83d24854d2b6f1e23a11b6497eab9a;hp=9b7837a46bef89c695f0be7097a254566b8d8939;hb=2b9bdd0f97172514efe265a517653c4e49d89f55;hpb=952084c4221c5708e02c783284cf0f7239c6b4c4 diff --git a/src/lib/exceptions.h b/src/lib/exceptions.h index 9b7837a46..80d4801da 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 = ""); @@ -388,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 { @@ -442,8 +466,8 @@ class PrivilegeError : public std::runtime_error { public: explicit PrivilegeError (std::string s) - : std::runtime_error (s) - {} + : std::runtime_error (s) + {} };