Tidy up some error handling a little.
[dcpomatic.git] / src / lib / exceptions.h
index c64f561a837ef478322fa53053ee8c5c8495adb1..8bce0c8abac7137a9ea3f62bdb396dfa774be696 100644 (file)
@@ -44,6 +44,14 @@ public:
        explicit DecodeError (std::string s)
                : std::runtime_error (s)
        {}
+
+       explicit DecodeError (std::string function, std::string caller)
+               : std::runtime_error (String::compose("%1 failed in %2", function, caller))
+       {}
+
+       explicit DecodeError (std::string function, std::string caller, int error)
+               : std::runtime_error (String::compose("%1 failed in %2 (%3)", function, caller, error))
+       {}
 };
 
 class CryptoError : public std::runtime_error