Throw a specific exception when no WEBVTT header is found.
[libsub.git] / src / web_vtt_reader.cc
index 2e772f143b99a8e65cdd0de325e500758faf9af3..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;
@@ -111,13 +111,13 @@ WebVTTReader::read(std::function<optional<string> ()> get_line)
                                }
 
                                string expected;
-                               auto from = SubripReader::convert_time(parts[0], &expected);
+                               auto from = SubripReader::convert_time(parts[0], ".", &expected);
                                if (!from) {
                                        throw WebVTTError(parts[0], expected, _context);
                                }
                                rs.from = *from;
 
-                               auto to = SubripReader::convert_time(parts[2], &expected);
+                               auto to = SubripReader::convert_time(parts[2], ".", &expected);
                                if (!to) {
                                        throw WebVTTError(parts[2], expected, _context);
                                }