2 * Copyright (C) 2005 Casper S. Hornstrup
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 along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23 Exception::Exception ()
27 Exception::Exception ( const string
& message
)
32 Exception::Exception ( const char* format
, ...)
35 va_start ( args
, format
);
36 _e
= ssvprintf ( format
, args
);
40 void Exception::SetMessage ( const char* format
, ...)
43 va_start ( args
, format
);
44 _e
= ssvprintf ( format
, args
);
48 void Exception::SetMessageV ( const char* message
, va_list args
)
50 _e
= ssvprintf ( message
, args
);
54 MissingArgumentException::MissingArgumentException ( const string
& argument
)
55 : Exception ( "Argument '%s' is missing",
61 OutOfMemoryException::OutOfMemoryException ()
62 : Exception ( "Out of memory" )
67 InvalidOperationException::InvalidOperationException (
69 const int linenumber
)
70 : Exception ( "%s:%d", filename
, linenumber
)
74 InvalidDateException::InvalidDateException ( const string
& filename
)
75 : Exception ( "File '%s' has an invalid date.",
81 InvalidOperationException::InvalidOperationException (
89 va_start ( args
, message
);
90 errorMessage
= ssvprintf ( message
, args
);
96 errorMessage
.c_str () );
100 FileNotFoundException::FileNotFoundException ( const string
& filename
)
101 : Exception ( "File '%s' not found.",
108 AccessDeniedException::AccessDeniedException ( const string
& filename
)
109 : Exception ( "Access denied to file or directory '%s'.",
116 RequiredAttributeNotFoundException::RequiredAttributeNotFoundException (
117 const string
& location
,
118 const string
& attributeName
,
119 const string
& elementName
)
120 : XMLInvalidBuildFileException (
122 "Required attribute '%s' not found on '%s'.",
123 attributeName
.c_str (),
124 elementName
.c_str ())
128 InvalidAttributeValueException::InvalidAttributeValueException (
129 const string
& location
,
131 const string
& value
)
132 : XMLInvalidBuildFileException (
134 "Attribute '%s' has an invalid value '%s'.",
141 BackendNameConflictException::BackendNameConflictException ( const string
& name
)
142 : Exception ( "Backend name conflict: '%s'",
148 UnknownBackendException::UnknownBackendException ( const string
& name
)
149 : Exception ( "Unknown Backend requested: '%s'",
155 UnknownModuleTypeException::UnknownModuleTypeException ( const string
& location
,
157 : XMLInvalidBuildFileException (
159 "module type requested: %i",
165 InvocationFailedException::InvocationFailedException ( const std::string
& command
,
167 : Exception ( "Failed to execute '%s' (exit code %d)",
176 UnsupportedBuildToolException::UnsupportedBuildToolException ( const std::string
& buildTool
,
177 const std::string
& version
)
178 : Exception ( "Build tool '%s' with version '%s' is unsupported. Please upgrade your build tool.",
182 BuildTool
= buildTool
;