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
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 Exception::Exception ()
27 Exception::Exception ( const string
& message
)
32 Exception::Exception ( const char* format
,
38 Message
= ssvprintf ( format
,
43 void Exception::SetMessage ( const char* message
,
46 Message
= ssvprintf ( message
,
51 OutOfMemoryException::OutOfMemoryException ()
52 : Exception ( "Out of memory" )
57 InvalidOperationException::InvalidOperationException ( const char* filename
,
58 const int linenumber
)
60 Message
= ssprintf ( "%s:%d",
65 InvalidOperationException::InvalidOperationException ( const char* filename
,
74 errorMessage
= ssvprintf ( message
,
77 Message
= ssprintf ( "%s:%d %s",
80 errorMessage
.c_str () );
84 FileNotFoundException::FileNotFoundException ( const string
& filename
)
85 : Exception ( "File '%s' not found.",
92 AccessDeniedException::AccessDeniedException ( const string
& filename
)
93 : Exception ( "Access denied to file or directory '%s'.",
100 InvalidBuildFileException::InvalidBuildFileException ( const string
& location
,
107 SetLocationMessage ( location
, message
, args
);
111 InvalidBuildFileException::InvalidBuildFileException ()
116 InvalidBuildFileException::SetLocationMessage ( const std::string
& location
,
120 Message
= location
+ ": " + ssvprintf ( message
, args
);
123 XMLSyntaxErrorException::XMLSyntaxErrorException ( const string
& location
,
130 SetLocationMessage ( location
, message
, args
);
135 RequiredAttributeNotFoundException::RequiredAttributeNotFoundException (
136 const string
& location
,
137 const string
& attributeName
,
138 const string
& elementName
)
139 : InvalidBuildFileException ( location
,
140 "Required attribute '%s' not found on '%s'.",
141 attributeName
.c_str (),
142 elementName
.c_str ())
146 InvalidAttributeValueException::InvalidAttributeValueException (
147 const string
& location
,
149 const string
& value
)
150 : InvalidBuildFileException ( location
,
151 "Attribute '%s' has an invalid value '%s'.",
158 BackendNameConflictException::BackendNameConflictException ( const string
& name
)
159 : Exception ( "Backend name conflict: '%s'",
165 UnknownBackendException::UnknownBackendException ( const string
& name
)
166 : Exception ( "Unknown Backend requested: '%s'",
172 UnknownModuleTypeException::UnknownModuleTypeException ( const string
& location
,
174 : InvalidBuildFileException ( location
,
175 "module type requested: %i",
181 InvocationFailedException::InvocationFailedException ( const std::string
& command
,
183 : Exception ( "Failed to execute '%s' (exit code %d)",
192 UnsupportedBuildToolException::UnsupportedBuildToolException ( const std::string
& buildTool
,
193 const std::string
& version
)
194 : Exception ( "Build tool '%s' with version '%s' is unsupported. Please upgrade your build tool.",
198 BuildTool
= buildTool
;