2 Copyright (C) 2012 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 /** @file src/exceptions.h
24 * @brief Exceptions thrown by libdcp.
30 /** @brief An exception related to a file */
31 class FileError : public std::exception
34 FileError (std::string const & message, std::string const & filename)
36 , _filename (filename)
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 std::string filename () const {
54 /** filename of file that was involved */
55 std::string _filename;
58 /** @brief An exception related to an MXF file */
59 class MXFFileError : public FileError
62 MXFFileError (std::string const & message, std::string const & filename)
63 : FileError (message, filename)
67 /** @brief A miscellaneous exception */
68 class MiscError : public std::exception
71 MiscError (std::string const & message) : _message (message) {}
72 ~MiscError () throw () {}
74 /** @return error message */
75 char const * what () const throw () {
76 return _message.c_str ();
84 /** @brief A DCP read exception */
85 class DCPReadError : public std::exception
88 DCPReadError (std::string const & message) : _message (message) {}
89 ~DCPReadError () throw () {}
91 /** @return error message */
92 char const * what () const throw () {
93 return _message.c_str ();
101 /** @brief An XML error */
102 class XMLError : public std::exception
105 XMLError (std::string const & message) : _message (message) {}
106 ~XMLError () throw () {}
108 /** @return error message */
109 char const * what () const throw () {
110 return _message.c_str ();
115 std::string _message;