Throw a specific exception when no WEBVTT header is found. main v1.6.47
authorCarl Hetherington <cth@carlh.net>
Tue, 6 Feb 2024 10:32:26 +0000 (11:32 +0100)
committerCarl Hetherington <cth@carlh.net>
Wed, 7 Feb 2024 00:03:23 +0000 (01:03 +0100)
src/exceptions.h
src/web_vtt_reader.cc

index 1895f110433f88f389193f4a780e8f6148276354..e0d0e90a9a2d6c7a4207bb1e732e9b0415dbe229 100644 (file)
@@ -90,6 +90,15 @@ private:
 };
 
 
+class WebVTTHeaderError : public WebVTTError
+{
+public:
+       WebVTTHeaderError()
+               : WebVTTError("No WEBVTT header found")
+       {}
+};
+
+
 class SSAError : public std::runtime_error
 {
 public:
index cd6844de48d45ee6e63ea8fee55e53f451b91975..4618466575fc471f3cc367948f3ef5b5fbdba554 100644 (file)
@@ -86,7 +86,7 @@ WebVTTReader::read(std::function<optional<string> ()> get_line)
                switch (state) {
                case State::HEADER:
                        if (!boost::starts_with(*line, "WEBVTT")) {
-                               throw WebVTTError("No WEBVTT header found");
+                               throw WebVTTHeaderError();
                        }
                        state = State::DATA;
                        break;