From 79e49c267f3e51126ad7d6c936de2da5455a9894 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Tue, 20 Sep 2016 21:07:57 +0100 Subject: Give a more informative exception on SubRip parse failures. --- src/exceptions.cc | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src/exceptions.cc') diff --git a/src/exceptions.cc b/src/exceptions.cc index 4d9d29f..d59d32a 100644 --- a/src/exceptions.cc +++ b/src/exceptions.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2014-2015 Carl Hetherington + Copyright (C) 2014-2016 Carl Hetherington This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -19,8 +19,10 @@ #include "compose.hpp" #include "exceptions.h" +#include using std::string; +using std::list; using namespace sub; ProgrammingError::ProgrammingError (string file, int line) @@ -28,3 +30,10 @@ ProgrammingError::ProgrammingError (string file, int line) { } + +SubripError::SubripError (string saw, string expecting, list context) + : runtime_error ("Error in SubRip file: saw " + (saw.empty() ? "an empty string" : saw) + " when expecting " + expecting) + , _context (context) +{ + +} -- cgit v1.2.3