/*
- Copyright (C) 2012-2014 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2012-2019 Carl Hetherington <cth@carlh.net>
This file is part of libdcp.
#define LIBDCP_EXCEPTIONS_H
#include <boost/filesystem.hpp>
+#include <boost/optional.hpp>
/** @file src/exceptions.h
* @brief Exceptions thrown by libdcp.
{
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<std::string> detail () const {
+ return _detail;
+ }
+
+private:
+ std::string _message;
+ boost::optional<std::string> _detail;
};
/** @class MissingAssetError
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
class KDMDecryptionError : public std::runtime_error
{
public:
- KDMDecryptionError (std::string message);
+ KDMDecryptionError (std::string message, int cipher_length, int modulus_dmax);
+};
+
+class KDMFormatError : public std::runtime_error
+{
+public:
+ KDMFormatError (std::string message);
+};
+
+class CertificateChainError : public std::runtime_error
+{
+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;
};
}