Pass force-cpp11 down to libcxml.
[libdcp.git] / src / exceptions.h
index 2688ee86000666ee419580a61fc44feacd888a9e..ccf7a081523b18e224360be563a9d3bd53a43b55 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2012-2014 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2012-2019 Carl Hetherington <cth@carlh.net>
 
     This file is part of libdcp.
 
@@ -35,6 +35,7 @@
 #define LIBDCP_EXCEPTIONS_H
 
 #include <boost/filesystem.hpp>
+#include <boost/optional.hpp>
 
 /** @file  src/exceptions.h
  *  @brief Exceptions thrown by libdcp.
@@ -97,25 +98,31 @@ 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<std::string> detail () const {
+               return _detail;
+       }
+
+private:
+       std::string _message;
+       boost::optional<std::string> _detail;
 };
 
-/** @class MissingAssetError
- *  @brief An error of a missing asset.
- */
-class MissingAssetError : public DCPReadError
+class BadContentKindError : public DCPReadError
 {
 public:
-       enum AssetType {
-               MAIN_PICTURE,  //< main picture is missing
-               MAIN_SOUND,    //< main sound is missing
-               MAIN_SUBTITLE, //< main subtitle is missing
-               UNKNOWN        //< something is missing but we don't know what
-       };
-
-       MissingAssetError (boost::filesystem::path, AssetType = UNKNOWN);
-       ~MissingAssetError () throw () {}
+       BadContentKindError (std::string content_kind);
 };
 
 /** @class XMLError
@@ -167,16 +174,41 @@ public:
        ProgrammingError (std::string file, int line);
 };
 
-class MismatchedStandardError : public DCPReadError
+class KDMDecryptionError : public std::runtime_error
 {
 public:
-       MismatchedStandardError ();
+       KDMDecryptionError (std::string message, int cipher_length, int modulus_dmax);
 };
 
-class KDMDecryptionError : public std::runtime_error
+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 BadKDMDateError : public std::runtime_error
 {
 public:
-       KDMDecryptionError (std::string message);
+       BadKDMDateError (bool starts_too_early);
+
+       bool starts_too_early () const {
+               return _starts_too_early;
+       }
+
+private:
+       bool _starts_too_early;
 };
 
 }