Improve error messages on failing to load DCP subs.
authorCarl Hetherington <cth@carlh.net>
Mon, 13 Jun 2016 22:12:18 +0000 (23:12 +0100)
committerCarl Hetherington <cth@carlh.net>
Mon, 13 Jun 2016 22:12:18 +0000 (23:12 +0100)
ChangeLog
cscript
src/lib/dcp_subtitle.cc

index 44b857dfc552ca04826234fe61b2ab59f61adcef..c57730218e331a2b4e2a5826094b0d894d97cfcc 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2016-06-13  Carl Hetherington  <cth@carlh.net>
+
+       * Give better error messages when subtitles fail to load.
+
 2016-06-13  c.hetherington  <cth@carlh.net>
 
        * Add button to move things to the start of reels (#798).
diff --git a/cscript b/cscript
index 260c0f2ec5d4f20478e4b28eb7b11239b1c197d7..82c39a0f8557c3fef7a90f29be7e87700c81340c 100644 (file)
--- a/cscript
+++ b/cscript
@@ -237,7 +237,7 @@ def dependencies(target):
         ffmpeg_options = {}
 
     return (('ffmpeg-cdist', 'aab2fb1', ffmpeg_options),
-            ('libdcp', 'd927e9b'),
+            ('libdcp', '937e435'),
             ('libsub', '3e299e5'))
 
 def configure_options(target):
index b0e114be2cda2ca72959bcad66d7f1416e88fcc7..f9aa7e0d9f103da6f38d54f5e35621c23c3b6731 100644 (file)
 
 #include "dcp_subtitle.h"
 #include "exceptions.h"
+#include "compose.hpp"
 #include <dcp/interop_subtitle_asset.h>
 #include <dcp/smpte_subtitle_asset.h>
 
 #include "i18n.h"
 
+using std::string;
+using std::exception;
 using boost::shared_ptr;
 
 shared_ptr<dcp::SubtitleAsset>
 DCPSubtitle::load (boost::filesystem::path file) const
 {
        shared_ptr<dcp::SubtitleAsset> 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;