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 #ifndef LIBDCP_EXCEPTIONS_H
21 #define LIBDCP_EXCEPTIONS_H
23 #include <boost/filesystem.hpp>
25 /** @file src/exceptions.h
26 * @brief Exceptions thrown by libdcp.
33 * @brief An exception related to a file
35 class FileError : public std::exception
38 FileError (std::string message, boost::filesystem::path filename, int number);
39 ~FileError () throw () {}
41 /** @return error message */
42 char const * what () const throw () {
43 return _message.c_str ();
46 /** @return filename of file that was involved */
47 boost::filesystem::path filename () const {
51 /** @return error number of the error */
59 /** filename of file that was involved */
60 boost::filesystem::path _filename;
64 /** @class MXFFileError
65 * @brief An exception related to an MXF file
67 class MXFFileError : public FileError
70 MXFFileError (std::string message, boost::filesystem::path filename, int number)
71 : FileError (message, filename, number)
76 * @brief A miscellaneous exception
78 class MiscError : public std::exception
81 MiscError (std::string message) : _message (message) {}
82 ~MiscError () throw () {}
84 /** @return error message */
85 char const * what () const throw () {
86 return _message.c_str ();
94 /** @class DCPReadError
95 * @brief A DCP read exception
97 class DCPReadError : public std::exception
100 DCPReadError (std::string message) : _message (message) {}
101 ~DCPReadError () throw () {}
103 /** @return error message */
104 char const * what () const throw () {
105 return _message.c_str ();
110 std::string _message;
114 * @brief An XML error
116 class XMLError : public std::exception
119 XMLError (std::string message) : _message (message) {}
120 ~XMLError () throw () {}
122 /** @return error message */
123 char const * what () const throw () {
124 return _message.c_str ();
129 std::string _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::exception
138 UnresolvedRefError (std::string id);
139 ~UnresolvedRefError () throw () {}
141 /** @return error message */
142 char const * what () const throw () {
143 return _message.c_str ();
147 std::string _message;