Improve errors when verifying a non-DCP directory.
authorCarl Hetherington <cth@carlh.net>
Wed, 17 Mar 2021 23:20:17 +0000 (00:20 +0100)
committerCarl Hetherington <cth@carlh.net>
Thu, 18 Mar 2021 22:30:48 +0000 (23:30 +0100)
src/dcp.cc
src/exceptions.cc
src/exceptions.h
src/verify.cc

index df1d531b6d6a168131831005b8ea444b8458ae13..20ff82f864177231de0f6c4790575dfe8fbd4ce0 100644 (file)
@@ -112,7 +112,7 @@ DCP::read (vector<dcp::VerificationNote>* notes, bool ignore_incorrect_picture_m
        } else if (boost::filesystem::exists (_directory / "ASSETMAP.xml")) {
                _asset_map = _directory / "ASSETMAP.xml";
        } else {
-               boost::throw_exception (ReadError(String::compose("Could not find ASSETMAP nor ASSETMAP.xml in '%1'", _directory.string())));
+               boost::throw_exception (MissingAssetmapError(_directory));
        }
 
        cxml::Document asset_map ("AssetMap");
index 30d11a68b9346337982068b0d9e4a993924c9a63..3d9b92cad993ecd5b37f781fb75c889b69cca96f 100644 (file)
@@ -191,3 +191,10 @@ NoReelsError::NoReelsError ()
 
 }
 
+
+MissingAssetmapError::MissingAssetmapError (boost::filesystem::path dir)
+       : ReadError (String::compose("Could not find ASSETMAP nor ASSETMAP.xml in '%1'", dir.string()))
+{
+
+}
+
index 48961073cf1138d4832816789bd2fbd2727266a2..78d0943e6eac7b6d5b683abd6ee8d156f0dc5089 100644 (file)
@@ -147,6 +147,16 @@ public:
 };
 
 
+/** @class MissingAssetmapError
+ *  @brief Thrown when no ASSETMAP was found when trying to read a DCP
+ */
+class MissingAssetmapError : public ReadError
+{
+public:
+       explicit MissingAssetmapError (boost::filesystem::path dir);
+};
+
+
 /** @class XMLError
  *  @brief An XML error
  */
index 8c36756306511661ba757d7588245c5751c5924f..d8a4f37f81c8ac081739dd49da51100e5c8aef00 100644 (file)
@@ -1122,8 +1122,12 @@ dcp::verify (
 
        for (auto dcp: dcps) {
                stage ("Checking DCP", dcp->directory());
+               bool carry_on = true;
                try {
                        dcp->read (&notes);
+               } catch (MissingAssetmapError& e) {
+                       notes.push_back ({VerificationNote::Type::ERROR, VerificationNote::Code::FAILED_READ, string(e.what())});
+                       carry_on = false;
                } catch (ReadError& e) {
                        notes.push_back ({VerificationNote::Type::ERROR, VerificationNote::Code::FAILED_READ, string(e.what())});
                } catch (XMLError& e) {
@@ -1134,6 +1138,10 @@ dcp::verify (
                        notes.push_back ({VerificationNote::Type::ERROR, VerificationNote::Code::FAILED_READ, string(e.what())});
                }
 
+               if (!carry_on) {
+                       continue;
+               }
+
                if (dcp->standard() != Standard::SMPTE) {
                        notes.push_back ({VerificationNote::Type::BV21_ERROR, VerificationNote::Code::INVALID_STANDARD});
                }