diff options
| author | Carl Hetherington <cth@carlh.net> | 2017-06-01 23:46:11 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2017-06-01 23:46:11 +0100 |
| commit | 70c0dfe78b63b4f9e3bc164cff47dbf0dd213519 (patch) | |
| tree | a6754139894cdaf6889c7fb16db44aa9ea567c11 /src/lib | |
| parent | 6ab8e99f22bfe61bddbd204d4265071729c1f37d (diff) | |
Improve an error message.
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/exceptions.cc | 4 | ||||
| -rw-r--r-- | src/lib/exceptions.h | 2 | ||||
| -rw-r--r-- | 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<ReferencedReelAsset> const & refs, list<shared_ptr LOG_GENERAL ("create_reel for %1-%2; %3 of %4", _period.from.get(), _period.to.get(), _reel_index, _reel_count); DCPOMATIC_ASSERT (reel_picture_asset); - DCPOMATIC_ASSERT (reel_picture_asset->duration() == _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 */ |
