summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2022-11-14 00:32:16 +0100
committerCarl Hetherington <cth@carlh.net>2022-11-14 00:32:16 +0100
commit09512a7cb428ddb7e092a67697aebcf422f8dba1 (patch)
treec5f597012bbff97c588eabbdce58af429146a128
parentcb8627cf8c0a7051b33b30904dca861a13cb623a (diff)
Add exception missing from previous commit.
-rw-r--r--src/exceptions.cc9
-rw-r--r--src/exceptions.h24
2 files changed, 33 insertions, 0 deletions
diff --git a/src/exceptions.cc b/src/exceptions.cc
index 72198fc..d09be61 100644
--- a/src/exceptions.cc
+++ b/src/exceptions.cc
@@ -30,9 +30,18 @@ ProgrammingError::ProgrammingError (string file, int line)
}
+
SubripError::SubripError (string saw, string expecting, list<string> context)
: runtime_error ("Error in SubRip file: saw " + (saw.empty() ? "an empty string" : saw) + " when expecting " + expecting)
, _context (context)
{
}
+
+
+WebVTTError::WebVTTError(string saw, string expecting, list<string> context)
+ : runtime_error("Error in WebVTT file: saw " + (saw.empty() ? "an empty string" : saw) + " when expecting " + expecting)
+ , _context(context)
+{
+
+}
diff --git a/src/exceptions.h b/src/exceptions.h
index a032252..2b2b09c 100644
--- a/src/exceptions.h
+++ b/src/exceptions.h
@@ -66,6 +66,30 @@ private:
std::list<std::string> _context;
};
+
+/** @class WebVTTError
+ * @brief An error raised when reading a WebVTT file.
+ */
+class WebVTTError : public std::runtime_error
+{
+public:
+ WebVTTError(std::string message)
+ : std::runtime_error(message.c_str())
+ {}
+
+ WebVTTError(std::string saw, std::string expecting, std::list<std::string> context);
+
+ ~WebVTTError() throw () {}
+
+ std::list<std::string> context() const {
+ return _context;
+ }
+
+private:
+ std::list<std::string> _context;
+};
+
+
class SSAError : public std::runtime_error
{
public: