diff options
| author | Carl Hetherington <cth@carlh.net> | 2017-04-05 00:12:59 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2017-04-05 00:12:59 +0100 |
| commit | ad46791780c9e59d001b63a74251ebc1f46cd36c (patch) | |
| tree | 6864aa249ad1af4f119c8b25268062408940a35a /src/lib | |
| parent | 2b404e6ce0c5936704e7e15d537f0e6db2d1d6ca (diff) | |
More detailed error with an invalid signer chain.
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/exceptions.cc | 6 | ||||
| -rw-r--r-- | src/lib/exceptions.h | 1 | ||||
| -rw-r--r-- | src/lib/writer.cc | 10 |
3 files changed, 13 insertions, 4 deletions
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<const Film> film, weak_ptr<Job> 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); } } |
