Give better errors on Subrip parse failures.
authorCarl Hetherington <cth@carlh.net>
Tue, 20 Sep 2016 20:09:02 +0000 (21:09 +0100)
committerCarl Hetherington <cth@carlh.net>
Tue, 20 Sep 2016 20:09:02 +0000 (21:09 +0100)
ChangeLog
cscript
src/lib/job.cc

index cde3b2b2eac82a292a62c98de81e97090af05a12..4f22c362e27363d31d9e5ff5528d279d34e63675 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
 2016-09-20  Carl Hetherington  <cth@carlh.net>
 
+       * Give better errors on SubRip parse failures.
+
        * Version 2.9.23 released.
 
 2016-09-20  Carl Hetherington  <cth@carlh.net>
diff --git a/cscript b/cscript
index ee481d4a04d6348b6d57528ea675520d01bee1de..3724ab4b12225e9392859e393a3c9ba4fc801618 100644 (file)
--- a/cscript
+++ b/cscript
@@ -234,7 +234,7 @@ def dependencies(target):
 
     return (('ffmpeg-cdist', '1d4a1a4', ffmpeg_options),
             ('libdcp', 'b105b7d'),
-            ('libsub', '067c21c'))
+            ('libsub', '79e49c2'))
 
 def configure_options(target):
     opt = ''
index 6e2bc9f53bed706910be46e5414efd9e253c43fa..ed0370479a5ae1ffb8de08b07e695323b56383de 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2012-2015 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2012-2016 Carl Hetherington <cth@carlh.net>
 
     This file is part of DCP-o-matic.
 
 #include "log.h"
 #include "compose.hpp"
 #include <dcp/exceptions.h>
+#include <sub/exceptions.h>
 #include <boost/thread.hpp>
 #include <boost/filesystem.hpp>
+#include <boost/foreach.hpp>
 #include <iostream>
 
 #include "i18n.h"
@@ -149,6 +151,17 @@ Job::run_wrapper ()
 
                set_state (FINISHED_CANCELLED);
 
+       } catch (sub::SubripError& e) {
+
+               string extra = "Error is near:\n";
+               BOOST_FOREACH (string i, e.context()) {
+                       extra += i + "\n";
+               }
+
+               set_error (e.what (), extra);
+               set_progress (1);
+               set_state (FINISHED_ERROR);
+
        } catch (std::bad_alloc& e) {
 
                set_error (_("Out of memory"), _("There was not enough memory to do this.  If you are running a 32-bit operating system try reducing the number of encoding threads in the General tab of Preferences."));