summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2016-09-20 21:09:02 +0100
committerCarl Hetherington <cth@carlh.net>2016-09-20 21:09:02 +0100
commit24ae62cee407a05ce391884ce3bce03f53de7982 (patch)
treea0abcc40eb077306e08aca71e15218b7e55d1f4c
parenta336236cc95034f25ffe503a2ca1c2de2557b296 (diff)
Give better errors on Subrip parse failures.
-rw-r--r--ChangeLog2
-rw-r--r--cscript2
-rw-r--r--src/lib/job.cc15
3 files changed, 17 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index cde3b2b2e..4f22c362e 100644
--- 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 ee481d4a0..3724ab4b1 100644
--- 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 = ''
diff --git a/src/lib/job.cc b/src/lib/job.cc
index 6e2bc9f53..ed0370479 100644
--- a/src/lib/job.cc
+++ b/src/lib/job.cc
@@ -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.
@@ -30,8 +30,10 @@
#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."));