From 7acc2f5d8edc157c206012cb83167845ec7d09c7 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Mon, 13 Jun 2016 23:12:18 +0100 Subject: Improve error messages on failing to load DCP subs. --- src/lib/dcp_subtitle.cc | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/lib/dcp_subtitle.cc b/src/lib/dcp_subtitle.cc index b0e114be2..f9aa7e0d9 100644 --- a/src/lib/dcp_subtitle.cc +++ b/src/lib/dcp_subtitle.cc @@ -20,34 +20,39 @@ #include "dcp_subtitle.h" #include "exceptions.h" +#include "compose.hpp" #include #include #include "i18n.h" +using std::string; +using std::exception; using boost::shared_ptr; shared_ptr DCPSubtitle::load (boost::filesystem::path file) const { shared_ptr sc; + string interop_error; + string smpte_error; try { sc.reset (new dcp::InteropSubtitleAsset (file)); - } catch (...) { - + } catch (exception& e) { + interop_error = e.what (); } if (!sc) { try { sc.reset (new dcp::SMPTESubtitleAsset (file)); - } catch (...) { - + } catch (exception& e) { + smpte_error = e.what(); } } if (!sc) { - throw FileError (_("Could not read subtitles"), file); + throw FileError (String::compose (_("Could not read subtitles (%1 / %2)"), interop_error, smpte_error), file); } return sc; -- cgit v1.2.3