diff options
| author | Carl Hetherington <cth@carlh.net> | 2021-03-18 00:20:17 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2021-03-18 23:30:48 +0100 |
| commit | 4078aaae757db466d727c667dd9197b56d6b3f58 (patch) | |
| tree | 47b733b51d838a7da708b9807478de1e166a5b4f /src | |
| parent | cf4e4272f72346c39964b128f78b2297f04dba55 (diff) | |
Improve errors when verifying a non-DCP directory.
Diffstat (limited to 'src')
| -rw-r--r-- | src/dcp.cc | 2 | ||||
| -rw-r--r-- | src/exceptions.cc | 7 | ||||
| -rw-r--r-- | src/exceptions.h | 10 | ||||
| -rw-r--r-- | src/verify.cc | 8 |
4 files changed, 26 insertions, 1 deletions
@@ -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"); diff --git a/src/exceptions.cc b/src/exceptions.cc index 30d11a68..3d9b92ca 100644 --- a/src/exceptions.cc +++ b/src/exceptions.cc @@ -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())) +{ + +} + diff --git a/src/exceptions.h b/src/exceptions.h index 48961073..78d0943e 100644 --- a/src/exceptions.h +++ b/src/exceptions.h @@ -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 */ diff --git a/src/verify.cc b/src/verify.cc index 8c367563..d8a4f37f 100644 --- a/src/verify.cc +++ b/src/verify.cc @@ -1122,8 +1122,12 @@ dcp::verify ( for (auto dcp: dcps) { stage ("Checking DCP", dcp->directory()); + bool carry_on = true; try { dcp->read (¬es); + } 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}); } |
