2 Copyright (C) 2012-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/>.
19 In addition, as a special exception, the copyright holders give
20 permission to link the code of portions of this program with the
21 OpenSSL library under certain conditions as described in each
22 individual source file, and distribute linked combinations
25 You must obey the GNU General Public License in all respects
26 for all of the code used other than OpenSSL. If you modify
27 file(s) with this exception, you may extend this exception to your
28 version of the file(s), but you are not obligated to do so. If you
29 do not wish to do so, delete this exception statement from your
30 version. If you delete this exception statement from all source
31 files in the program, then also delete it here.
34 #ifndef LIBDCP_EXCEPTIONS_H
35 #define LIBDCP_EXCEPTIONS_H
37 #include <boost/filesystem.hpp>
39 /** @file src/exceptions.h
40 * @brief Exceptions thrown by libdcp.
47 * @brief An exception related to a file
49 class FileError : public std::runtime_error
52 FileError (std::string message, boost::filesystem::path filename, int number);
53 ~FileError () throw () {}
55 /** @return filename of file that was involved */
56 boost::filesystem::path filename () const {
60 /** @return error number of the error */
66 /** filename of file that was involved */
67 boost::filesystem::path _filename;
71 /** @class MXFFileError
72 * @brief An exception related to an MXF file
74 class MXFFileError : public FileError
77 MXFFileError (std::string message, boost::filesystem::path filename, int number)
78 : FileError (message, filename, number)
83 * @brief A miscellaneous exception
85 class MiscError : public std::runtime_error
88 explicit MiscError (std::string message)
89 : std::runtime_error (message)
93 /** @class DCPReadError
94 * @brief A DCP read exception
96 class DCPReadError : public std::runtime_error
99 explicit DCPReadError (std::string message)
100 : std::runtime_error (message)
104 /** @class MissingAssetError
105 * @brief An error of a missing asset.
107 class MissingAssetError : public DCPReadError
111 MAIN_PICTURE, //< main picture is missing
112 MAIN_SOUND, //< main sound is missing
113 MAIN_SUBTITLE, //< main subtitle is missing
114 UNKNOWN //< something is missing but we don't know what
117 MissingAssetError (boost::filesystem::path, AssetType = UNKNOWN);
118 ~MissingAssetError () throw () {}
122 * @brief An XML error
124 class XMLError : public std::runtime_error
127 explicit XMLError (std::string message)
128 : std::runtime_error (message)
132 /** @class UnresolvedRefError
133 * @brief An exception caused by a reference (by UUID) to something which is not known
135 class UnresolvedRefError : public std::runtime_error
138 explicit UnresolvedRefError (std::string id);
141 /** @class TimeFormatError
142 * @brief A an error with a string passed to LocalTime.
144 class TimeFormatError : public std::runtime_error
147 explicit TimeFormatError (std::string bad_time);
150 /** @class NotEncryptedError
151 * @brief An error raised when creating a DecryptedKDM object for assets that are not
154 class NotEncryptedError : public std::runtime_error
157 explicit NotEncryptedError (std::string const & what);
158 ~NotEncryptedError () throw () {}
161 /** @class ProgrammingError
162 * @brief An exception thrown when a DCP_ASSERT fails; something that should not happen.
164 class ProgrammingError : public std::runtime_error
167 ProgrammingError (std::string file, int line);
170 class MismatchedStandardError : public DCPReadError
173 MismatchedStandardError ();
176 class KDMDecryptionError : public std::runtime_error
179 KDMDecryptionError (std::string message, int cipher_length, int modulus_dmax);
182 class KDMFormatError : public std::runtime_error
185 KDMFormatError (std::string message);
188 class CertificateChainError : public std::runtime_error
191 CertificateChainError (std::string message);