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
, ...)
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 OutOfMemoryException::OutOfMemoryException ()
55 : Exception ( "Out of memory" )
60 InvalidOperationException::InvalidOperationException (
62 const int linenumber
)
63 : Exception ( "%s:%d", filename
, linenumber
)
67 InvalidOperationException::InvalidOperationException (
75 va_start ( args
, message
);
76 errorMessage
= ssvprintf ( message
, args
);
82 errorMessage
.c_str () );
86 FileNotFoundException::FileNotFoundException ( const string
& filename
)
87 : Exception ( "File '%s' not found.",
94 AccessDeniedException::AccessDeniedException ( const string
& filename
)
95 : Exception ( "Access denied to file or directory '%s'.",
102 RequiredAttributeNotFoundException::RequiredAttributeNotFoundException (
103 const string
& location
,
104 const string
& attributeName
,
105 const string
& elementName
)
106 : XMLInvalidBuildFileException (
108 "Required attribute '%s' not found on '%s'.",
109 attributeName
.c_str (),
110 elementName
.c_str ())
114 InvalidAttributeValueException::InvalidAttributeValueException (
115 const string
& location
,
117 const string
& value
)
118 : XMLInvalidBuildFileException (
120 "Attribute '%s' has an invalid value '%s'.",
127 BackendNameConflictException::BackendNameConflictException ( const string
& name
)
128 : Exception ( "Backend name conflict: '%s'",
134 UnknownBackendException::UnknownBackendException ( const string
& name
)
135 : Exception ( "Unknown Backend requested: '%s'",
141 UnknownModuleTypeException::UnknownModuleTypeException ( const string
& location
,
143 : XMLInvalidBuildFileException (
145 "module type requested: %i",
151 InvocationFailedException::InvocationFailedException ( const std::string
& command
,
153 : Exception ( "Failed to execute '%s' (exit code %d)",
162 UnsupportedBuildToolException::UnsupportedBuildToolException ( const std::string
& buildTool
,
163 const std::string
& version
)
164 : Exception ( "Build tool '%s' with version '%s' is unsupported. Please upgrade your build tool.",
168 BuildTool
= buildTool
;