2 Copyright (C) 2014 Carl Hetherington <cth@carlh.net>
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 /** @file src/exceptions.cc
21 * @brief Exceptions thrown by libdcp.
24 #include "exceptions.h"
25 #include "compose.hpp"
28 using std::runtime_error;
31 FileError::FileError (string message, boost::filesystem::path filename, int number)
32 : runtime_error (String::compose ("%1 (%2) (error %3)", message, filename.string(), number))
33 , _filename (filename)
39 UnresolvedRefError::UnresolvedRefError (string id)
40 : runtime_error (String::compose ("Unresolved reference to asset id %1", id))
45 TimeFormatError::TimeFormatError (string bad_time)
46 : runtime_error (String::compose ("Bad time string %1", bad_time))
51 MissingAssetError::MissingAssetError (boost::filesystem::path path, AssetType type)
53 type == MAIN_PICTURE ? String::compose ("Missing asset %1 for main picture", path.string()) :
54 (type == MAIN_SOUND ? String::compose ("Missing asset %1 for main sound", path.string()) :
55 (type == MAIN_SUBTITLE ? String::compose ("Missing asset %1 for main subtitle", path.string()) :
56 String::compose ("Missing asset %1", path.string()))))
61 NotEncryptedError::NotEncryptedError (string const & what)
62 : runtime_error (String::compose ("%1 is not encrypted", what))
68 ProgrammingError::ProgrammingError (string file, int line)
69 : runtime_error (String::compose ("Programming error at %1:%2", file, line))