X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fexceptions.cc;h=d394ad4b2c4e41e1c8285e31b21efc3d1374e9c2;hb=a1f7bf2d9e5610075fbd898cdf52f4f8373741f2;hp=43a8f3b86bfc1fb45f9f1160158a15386037af92;hpb=9e7fa70994ce4064555d0793fb8d1124b8c0e19a;p=dcpomatic.git diff --git a/src/lib/exceptions.cc b/src/lib/exceptions.cc index 43a8f3b86..d394ad4b2 100644 --- a/src/lib/exceptions.cc +++ b/src/lib/exceptions.cc @@ -27,10 +27,11 @@ using std::string; using std::runtime_error; /** @param f File that we were trying to open */ -OpenFileError::OpenFileError (boost::filesystem::path f, int error, bool reading) +OpenFileError::OpenFileError (boost::filesystem::path f, int error, Mode mode) : FileError ( String::compose ( - reading ? _("could not open file %1 for reading (%2)") : _("could not open file %1 for writing (%2)"), + mode == READ_WRITE ? _("could not open file %1 for read/write (%2)") : + (mode == READ ? _("could not open file %1 for read (%2)") : _("could not open file %1 for write (%2)")), f.string(), error), f @@ -39,6 +40,13 @@ OpenFileError::OpenFileError (boost::filesystem::path f, int error, bool reading } +FileNotFoundError::FileNotFoundError (boost::filesystem::path f) + : runtime_error(String::compose("File %1 not found", f.string())) + , _file (f) +{ + +} + ReadFileError::ReadFileError (boost::filesystem::path f, int e) : FileError (String::compose (_("could not read from file %1 (%2)"), f.string(), strerror (e)), f) { @@ -89,4 +97,37 @@ ProgrammingError::ProgrammingError (string file, int line, string message) KDMAsContentError::KDMAsContentError () : runtime_error (_("This file is a KDM. KDMs should be added to DCP content by right-clicking the content and choosing \"Add KDM\".")) -{} +{ + +} + +KDMError::KDMError (string s, string d) + : runtime_error (String::compose ("%1 (%2)", s, d)) + , _summary (s) + , _detail (d) +{ + +} + +GLError::GLError (char const * last, int e) + : runtime_error (String::compose("%1 failed %2", last, e)) +{ + +} + +CopyError::CopyError (string m, int n) + : runtime_error (String::compose("%1 (%2)", m, n)) + , _message (m) + , _number (n) +{ + +} + +VerifyError::VerifyError (string m, int n) + : runtime_error (String::compose("%1 (%2)", m, n)) + , _message (m) + , _number (n) +{ + +} +