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 InvalidDateException::InvalidDateException ( const string
& filename
)
68 : Exception ( "File '%s' has an invalid date.",
74 InvalidOperationException::InvalidOperationException (
82 va_start ( args
, message
);
83 errorMessage
= ssvprintf ( message
, args
);
89 errorMessage
.c_str () );
93 FileNotFoundException::FileNotFoundException ( const string
& filename
)
94 : Exception ( "File '%s' not found.",
101 AccessDeniedException::AccessDeniedException ( const string
& filename
)
102 : Exception ( "Access denied to file or directory '%s'.",
109 RequiredAttributeNotFoundException::RequiredAttributeNotFoundException (
110 const string
& location
,
111 const string
& attributeName
,
112 const string
& elementName
)
113 : XMLInvalidBuildFileException (
115 "Required attribute '%s' not found on '%s'.",
116 attributeName
.c_str (),
117 elementName
.c_str ())
121 InvalidAttributeValueException::InvalidAttributeValueException (
122 const string
& location
,
124 const string
& value
)
125 : XMLInvalidBuildFileException (
127 "Attribute '%s' has an invalid value '%s'.",
134 BackendNameConflictException::BackendNameConflictException ( const string
& name
)
135 : Exception ( "Backend name conflict: '%s'",
141 UnknownBackendException::UnknownBackendException ( const string
& name
)
142 : Exception ( "Unknown Backend requested: '%s'",
148 UnknownModuleTypeException::UnknownModuleTypeException ( const string
& location
,
150 : XMLInvalidBuildFileException (
152 "module type requested: %i",
158 InvocationFailedException::InvocationFailedException ( const std::string
& command
,
160 : Exception ( "Failed to execute '%s' (exit code %d)",
169 UnsupportedBuildToolException::UnsupportedBuildToolException ( const std::string
& buildTool
,
170 const std::string
& version
)
171 : Exception ( "Build tool '%s' with version '%s' is unsupported. Please upgrade your build tool.",
175 BuildTool
= buildTool
;