summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2018-09-18 20:25:21 +0100
committerCarl Hetherington <cth@carlh.net>2018-09-18 20:25:21 +0100
commit09d57c4e580533c959a0d0d07051f0aef9317628 (patch)
tree989ec43fe87fc8e3c4a13c0cf754a8a5a349c757 /src
parentee05b1c06aa5305b5c97dc74dc8f253bab99a2ac (diff)
Throw a better error on bad content kind.
Diffstat (limited to 'src')
-rw-r--r--src/exceptions.cc8
-rw-r--r--src/exceptions.h6
-rw-r--r--src/util.cc2
3 files changed, 14 insertions, 2 deletions
diff --git a/src/exceptions.cc b/src/exceptions.cc
index 1ded4483..5c486d09 100644
--- a/src/exceptions.cc
+++ b/src/exceptions.cc
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2014 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2014-2018 Carl Hetherington <cth@carlh.net>
This file is part of libdcp.
@@ -72,6 +72,12 @@ MissingAssetError::MissingAssetError (boost::filesystem::path path, AssetType ty
}
+BadContentKindError::BadContentKindError (string content_kind)
+ : DCPReadError (String::compose("Bad content kind '%1'", content_kind))
+{
+
+}
+
NotEncryptedError::NotEncryptedError (string const & what)
: runtime_error (String::compose ("%1 is not encrypted", what))
{
diff --git a/src/exceptions.h b/src/exceptions.h
index 8bc6e550..d66e8944 100644
--- a/src/exceptions.h
+++ b/src/exceptions.h
@@ -136,6 +136,12 @@ public:
~MissingAssetError () throw () {}
};
+class BadContentKindError : public DCPReadError
+{
+public:
+ BadContentKindError (std::string content_kind);
+};
+
/** @class XMLError
* @brief An XML error
*/
diff --git a/src/util.cc b/src/util.cc
index 3d90ccaa..ac97af6e 100644
--- a/src/util.cc
+++ b/src/util.cc
@@ -214,7 +214,7 @@ dcp::content_kind_from_string (string kind)
return ADVERTISEMENT;
}
- DCP_ASSERT (false);
+ throw BadContentKindError (kind);
}
/** @param s A string.