Add exception missing from previous commit.
authorCarl Hetherington <cth@carlh.net>
Sun, 13 Nov 2022 23:32:16 +0000 (00:32 +0100)
committerCarl Hetherington <cth@carlh.net>
Sun, 13 Nov 2022 23:32:16 +0000 (00:32 +0100)
src/exceptions.cc
src/exceptions.h

index 72198fcefffe0bbfe4689b38b84bfe39fc84c332..d09be61ae8927bbce41826b75fd9890ecc46c7c9 100644 (file)
@@ -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)
+{
+
+}
index a032252163bf79075c26aa408ad7ee5405d9107e..2b2b09c3fa32de5290b326515387c176b014b3f6 100644 (file)
@@ -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: