No-op: whitespace.
[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 namespace dcp;
29
30 FileError::FileError (string message, boost::filesystem::path filename, int number)
31         : StringError (String::compose ("%1 (%2) (error %3)", message, filename.string(), number))
32         , _filename (filename)
33         , _number (number)
34 {
35
36 }
37
38 UnresolvedRefError::UnresolvedRefError (string id)
39         : StringError (String::compose ("Unresolved reference to asset id %1", id))
40 {
41
42 }
43
44 TimeFormatError::TimeFormatError (string bad_time)
45         : StringError (String::compose ("Bad time string %1", bad_time))
46 {
47
48 }
49
50 MissingAssetError::MissingAssetError (boost::filesystem::path path, AssetType type)
51         : _path (path)
52         , _type (type)
53 {
54         string type_name;
55         switch (_type) {
56         case MAIN_PICTURE:
57                 type_name = " for main picture";
58                 break;
59         case MAIN_SOUND:
60                 type_name = " for main sound";
61                 break;
62         case MAIN_SUBTITLE:
63                 type_name = " for main subtitle";
64                 break;
65         case UNKNOWN:
66                 break;
67         }
68
69         _message = String::compose ("Missing asset %1%2", path.string(), type_name);
70 }
71
72 NotEncryptedError::NotEncryptedError (string const & what)
73         : StringError (String::compose ("%1 is not encrypted", what))
74 {
75
76 }
77
78
79 ProgrammingError::ProgrammingError (string file, int line)
80         : StringError (String::compose ("Programming error at %1:%2", file, line))
81 {
82
83 }