2 Copyright (C) 2014 Carl Hetherington <cth@carlh.net>
4 This file is part of libdcp.
6 libdcp is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 libdcp is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with libdcp. If not, see <http://www.gnu.org/licenses/>.
21 /** @file src/exceptions.cc
22 * @brief Exceptions thrown by libdcp.
25 #include "exceptions.h"
26 #include "compose.hpp"
29 using std::runtime_error;
32 FileError::FileError (string message, boost::filesystem::path filename, int number)
33 : runtime_error (String::compose ("%1 (%2) (error %3)", message, filename.string(), number))
34 , _filename (filename)
40 UnresolvedRefError::UnresolvedRefError (string id)
41 : runtime_error (String::compose ("Unresolved reference to asset id %1", id))
46 TimeFormatError::TimeFormatError (string bad_time)
47 : runtime_error (String::compose ("Bad time string %1", bad_time))
52 MissingAssetError::MissingAssetError (boost::filesystem::path path, AssetType type)
54 type == MAIN_PICTURE ? String::compose ("Missing asset %1 for main picture", path.string()) :
55 (type == MAIN_SOUND ? String::compose ("Missing asset %1 for main sound", path.string()) :
56 (type == MAIN_SUBTITLE ? String::compose ("Missing asset %1 for main subtitle", path.string()) :
57 String::compose ("Missing asset %1", path.string()))))
62 NotEncryptedError::NotEncryptedError (string const & what)
63 : runtime_error (String::compose ("%1 is not encrypted", what))
69 ProgrammingError::ProgrammingError (string file, int line)
70 : runtime_error (String::compose ("Programming error at %1:%2", file, line))
75 MismatchedStandardError::MismatchedStandardError ()
76 : DCPReadError ("DCP contains both Interop and SMPTE parts")