2 Copyright (C) 2012-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/lib/exceptions.h
21 * @brief Our exceptions.
24 #ifndef DCPOMATIC_EXCEPTIONS_H
25 #define DCPOMATIC_EXCEPTIONS_H
28 #include <libavutil/pixfmt.h>
30 #include <boost/filesystem.hpp>
34 /** @class DecodeError
35 * @brief A low-level problem with the decoder (possibly due to the nature
38 class DecodeError : public std::runtime_error
41 DecodeError (std::string s)
42 : std::runtime_error (s)
46 /** @class EncodeError
47 * @brief A low-level problem with an encoder.
49 class EncodeError : public std::runtime_error
52 EncodeError (std::string s)
53 : std::runtime_error (s)
58 * @brief Parent class for file-related errors.
60 class FileError : public std::runtime_error
63 /** @param m Error message.
64 * @param f Name of the file that this exception concerns.
66 FileError (std::string m, boost::filesystem::path f)
67 : std::runtime_error (m)
71 virtual ~FileError () throw () {}
73 /** @return name of the file that this exception concerns */
74 boost::filesystem::path file () const {
79 /** name of the file that this exception concerns */
80 boost::filesystem::path _file;
83 class JoinError : public std::runtime_error
86 JoinError (std::string s)
87 : std::runtime_error (s)
91 /** @class OpenFileError.
92 * @brief Indicates that some error occurred when trying to open a file.
94 class OpenFileError : public FileError
97 /** @param f File that we were trying to open */
98 OpenFileError (boost::filesystem::path f);
101 /** @class CreateFileError.
102 * @brief Indicates that some error occurred when trying to create a file.
104 class CreateFileError : public FileError
107 /** @param f File that we were trying to create */
108 CreateFileError (boost::filesystem::path f);
112 /** @class ReadFileError.
113 * @brief Indicates that some error occurred when trying to read from a file
115 class ReadFileError : public FileError
118 /** @param f File that we were trying to read from.
119 * @param e errno value, or 0.
121 ReadFileError (boost::filesystem::path f, int e = 0);
124 /** @class WriteFileError.
125 * @brief Indicates that some error occurred when trying to write to a file
127 class WriteFileError : public FileError
130 /** @param f File that we were trying to write to.
131 * @param e errno value, or 0.
133 WriteFileError (boost::filesystem::path f, int e);
136 /** @class SettingError.
137 * @brief Indicates that something is wrong with a setting.
139 class SettingError : public std::runtime_error
142 /** @param s Name of setting that was required.
145 SettingError (std::string s, std::string m)
146 : std::runtime_error (m)
150 virtual ~SettingError () throw () {}
152 /** @return name of setting in question */
153 std::string setting () const {
158 std::string _setting;
161 /** @class MissingSettingError.
162 * @brief Indicates that a Film is missing a setting that is required for some operation.
164 class MissingSettingError : public SettingError
167 /** @param s Name of setting that was required */
168 MissingSettingError (std::string s);
171 /** @class BadSettingError
172 * @brief Indicates that a setting is bad in some way.
174 class BadSettingError : public SettingError
177 /** @param s Name of setting that is bad */
178 BadSettingError (std::string s, std::string m)
179 : SettingError (s, m)
183 /** @class NetworkError
184 * @brief Indicates some problem with communication on the network.
186 class NetworkError : public std::runtime_error
189 NetworkError (std::string s)
190 : std::runtime_error (s)
195 * @brief A problem with a KDM.
197 class KDMError : public std::runtime_error
200 KDMError (std::string s)
201 : std::runtime_error (s)
205 /** @class PixelFormatError
206 * @brief A problem with an unsupported pixel format.
208 class PixelFormatError : public std::runtime_error
211 PixelFormatError (std::string o, AVPixelFormat f);
214 /** @class TextSubtitleError
215 * @brief An error that occurs while parsing a TextSubtitleError file.
217 class TextSubtitleError : public FileError
220 TextSubtitleError (std::string, std::string, boost::filesystem::path);
223 class DCPError : public std::runtime_error
226 DCPError (std::string s)
227 : std::runtime_error (s)
231 class InvalidSignerError : public std::runtime_error
234 InvalidSignerError ();
237 class ProgrammingError : public std::runtime_error
240 ProgrammingError (std::string file, int line);
243 class TextEncodingError : public std::runtime_error
246 TextEncodingError (std::string s)
247 : std::runtime_error (s)