summaryrefslogtreecommitdiff
path: root/src/lib
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 /src/lib
parenta336236cc95034f25ffe503a2ca1c2de2557b296 (diff)
Give better errors on Subrip parse failures.
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/job.cc15
1 files changed, 14 insertions, 1 deletions
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."));