No-op; Fix GPL address and mention libdcp by name.
[libdcp.git] / src / exceptions.cc
1 /*
2     Copyright (C) 2014 Carl Hetherington <cth@carlh.net>
3
4     This file is part of libdcp.
5
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.
10
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.
15
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/>.
18
19 */
20
21 /** @file  src/exceptions.cc
22  *  @brief Exceptions thrown by libdcp.
23  */
24
25 #include "exceptions.h"
26 #include "compose.hpp"
27
28 using std::string;
29 using std::runtime_error;
30 using namespace dcp;
31
32 FileError::FileError (string message, boost::filesystem::path filename, int number)
33         : runtime_error (String::compose ("%1 (%2) (error %3)", message, filename.string(), number))
34         , _filename (filename)
35         , _number (number)
36 {
37
38 }
39
40 UnresolvedRefError::UnresolvedRefError (string id)
41         : runtime_error (String::compose ("Unresolved reference to asset id %1", id))
42 {
43
44 }
45
46 TimeFormatError::TimeFormatError (string bad_time)
47         : runtime_error (String::compose ("Bad time string %1", bad_time))
48 {
49
50 }
51
52 MissingAssetError::MissingAssetError (boost::filesystem::path path, AssetType type)
53         : DCPReadError (
54                 type == MAIN_PICTURE    ? String::compose ("Missing asset %1 for main picture", path.string()) :
55                 (type == MAIN_SOUND     ? String::compose ("Missing asset %1 for main sound", path.string()) :
56                  (type == MAIN_SUBTITLE ? String::compose ("Missing asset %1 for main subtitle", path.string()) :
57                   String::compose ("Missing asset %1", path.string()))))
58 {
59
60 }
61
62 NotEncryptedError::NotEncryptedError (string const & what)
63         : runtime_error (String::compose ("%1 is not encrypted", what))
64 {
65
66 }
67
68
69 ProgrammingError::ProgrammingError (string file, int line)
70         : runtime_error (String::compose ("Programming error at %1:%2", file, line))
71 {
72
73 }
74
75 MismatchedStandardError::MismatchedStandardError ()
76         : DCPReadError ("DCP contains both Interop and SMPTE parts")
77 {
78
79 }