From 70c0dfe78b63b4f9e3bc164cff47dbf0dd213519 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Thu, 1 Jun 2017 23:46:11 +0100 Subject: [PATCH] Improve an error message. --- src/lib/exceptions.cc | 4 ++-- src/lib/exceptions.h | 2 +- src/lib/reel_writer.cc | 7 ++++++- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/lib/exceptions.cc b/src/lib/exceptions.cc index cf3708896..4e1e1ade3 100644 --- a/src/lib/exceptions.cc +++ b/src/lib/exceptions.cc @@ -81,8 +81,8 @@ InvalidSignerError::InvalidSignerError (string reason) } -ProgrammingError::ProgrammingError (string file, int line) - : runtime_error (String::compose (_("Programming error at %1:%2"), file, line)) +ProgrammingError::ProgrammingError (string file, int line, string message) + : runtime_error (String::compose (_("Programming error at %1:%2 %3"), file, line, message)) { } diff --git a/src/lib/exceptions.h b/src/lib/exceptions.h index c1b1aef4b..08cbcb1d6 100644 --- a/src/lib/exceptions.h +++ b/src/lib/exceptions.h @@ -233,7 +233,7 @@ public: class ProgrammingError : public std::runtime_error { public: - ProgrammingError (std::string file, int line); + ProgrammingError (std::string file, int line, std::string message = ""); }; class TextEncodingError : public std::runtime_error diff --git a/src/lib/reel_writer.cc b/src/lib/reel_writer.cc index 2c74d66bd..27f10d1ed 100644 --- a/src/lib/reel_writer.cc +++ b/src/lib/reel_writer.cc @@ -361,7 +361,12 @@ ReelWriter::create_reel (list const & refs, listduration() == _period.duration().frames_round (_film->video_frame_rate ())); + if (reel_picture_asset->duration() != _period.duration().frames_round (_film->video_frame_rate ())) { + throw ProgrammingError ( + __FILE__, __LINE__, + String::compose ("%1 vs %2", reel_picture_asset->duration(), _period.duration().frames_round (_film->video_frame_rate ())) + ); + } reel->add (reel_picture_asset); /* If we have a hash for this asset in the CPL, assume that it is correct */ -- 2.30.2