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