X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Fexceptions.h;h=17b18eb2876f38ee74b58bc85524e099d545bb75;hb=4c1a8e66f754d26e3db9c4c651e19ff4b6a94bb9;hp=f187df1c820f62e508c4afdc05217e54176450dd;hpb=60299c4e299c6efe9d516ede7e8fa732646a3de0;p=libdcp.git diff --git a/src/exceptions.h b/src/exceptions.h index f187df1c..17b18eb2 100644 --- a/src/exceptions.h +++ b/src/exceptions.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2012-2014 Carl Hetherington + Copyright (C) 2012-2019 Carl Hetherington This file is part of libdcp. @@ -35,6 +35,7 @@ #define LIBDCP_EXCEPTIONS_H #include +#include /** @file src/exceptions.h * @brief Exceptions thrown by libdcp. @@ -97,8 +98,25 @@ class DCPReadError : public std::runtime_error { public: explicit DCPReadError (std::string message) - : std::runtime_error (message) + : std::runtime_error(message) + , _message(message) {} + + DCPReadError (std::string message, std::string detail); + + ~DCPReadError() throw () {} + + std::string message () const { + return _message; + } + + boost::optional detail () const { + return _detail; + } + +private: + std::string _message; + boost::optional _detail; }; /** @class MissingAssetError @@ -116,6 +134,19 @@ public: MissingAssetError (boost::filesystem::path, AssetType = UNKNOWN); ~MissingAssetError () throw () {} + + boost::filesystem::path path () const { + return _path; + } + +private: + boost::filesystem::path _path; +}; + +class BadContentKindError : public DCPReadError +{ +public: + BadContentKindError (std::string content_kind); }; /** @class XMLError @@ -191,6 +222,31 @@ public: CertificateChainError (std::string message); }; +class MissingSubtitleImageError : public std::runtime_error +{ +public: + MissingSubtitleImageError (std::string id); +}; + +class EmptyAssetPathError : public DCPReadError +{ +public: + EmptyAssetPathError (std::string id); +}; + +class BadKDMDateError : public std::runtime_error +{ +public: + BadKDMDateError (bool starts_too_early); + + bool starts_too_early () const { + return _starts_too_early; + } + +private: + bool _starts_too_early; +}; + } #endif