From ad46791780c9e59d001b63a74251ebc1f46cd36c Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Wed, 5 Apr 2017 00:12:59 +0100 Subject: [PATCH] More detailed error with an invalid signer chain. --- cscript | 2 +- src/lib/exceptions.cc | 6 ++++++ src/lib/exceptions.h | 1 + src/lib/writer.cc | 10 ++++++---- 4 files changed, 14 insertions(+), 5 deletions(-) diff --git a/cscript b/cscript index 480f4b91b..5c50f476e 100644 --- a/cscript +++ b/cscript @@ -270,7 +270,7 @@ def dependencies(target): ffmpeg_options = {} return (('ffmpeg-cdist', 'c7df8d5', ffmpeg_options), - ('libdcp', 'ce32d6c'), + ('libdcp', '45fd755'), ('libsub', '733dfda')) def configure_options(target): diff --git a/src/lib/exceptions.cc b/src/lib/exceptions.cc index cef6e7447..4590531b7 100644 --- a/src/lib/exceptions.cc +++ b/src/lib/exceptions.cc @@ -75,6 +75,12 @@ InvalidSignerError::InvalidSignerError () } +InvalidSignerError::InvalidSignerError (string reason) + : runtime_error (String::compose (_("The certificate chain for signing is invalid (%1)"), reason)) +{ + +} + ProgrammingError::ProgrammingError (string file, int line) : runtime_error (String::compose (_("Programming error at %1:%2"), file, line)) { diff --git a/src/lib/exceptions.h b/src/lib/exceptions.h index 98727e0cc..99a8c0dc4 100644 --- a/src/lib/exceptions.h +++ b/src/lib/exceptions.h @@ -225,6 +225,7 @@ class InvalidSignerError : public std::runtime_error { public: InvalidSignerError (); + InvalidSignerError (std::string reason); }; class ProgrammingError : public std::runtime_error diff --git a/src/lib/writer.cc b/src/lib/writer.cc index 595915883..6e6bedb8f 100644 --- a/src/lib/writer.cc +++ b/src/lib/writer.cc @@ -95,8 +95,9 @@ Writer::Writer (shared_ptr film, weak_ptr j) _subtitle_reel = _reels.begin (); /* Check that the signer is OK if we need one */ - if (_film->is_signed() && !Config::instance()->signer_chain()->valid ()) { - throw InvalidSignerError (); + string reason; + if (_film->is_signed() && !Config::instance()->signer_chain()->valid(&reason)) { + throw InvalidSignerError (reason); } } @@ -510,8 +511,9 @@ Writer::finish () if (_film->is_signed ()) { signer = Config::instance()->signer_chain (); /* We did check earlier, but check again here to be on the safe side */ - if (!signer->valid ()) { - throw InvalidSignerError (); + string reason; + if (!signer->valid (&reason)) { + throw InvalidSignerError (reason); } } -- 2.30.2