1 mike 1.10 //%/////////////////////////////////////////////////////////////////////////////
|
2 mike 1.1 //
3 // Copyright (c) 2000 The Open Group, BMC Software, Tivoli Systems, IBM
4 //
5 // Permission is hereby granted, free of charge, to any person obtaining a
6 // copy of this software and associated documentation files (the "Software"),
7 // to deal in the Software without restriction, including without limitation
8 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
9 // and/or sell copies of the Software, and to permit persons to whom the
10 // Software is furnished to do so, subject to the following conditions:
11 //
12 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
13 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
14 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
15 // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
16 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
17 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
18 // DEALINGS IN THE SOFTWARE.
19 //
|
20 mike 1.10 //==============================================================================
|
21 mike 1.1 //
|
22 mike 1.10 // Author: Mike Brasher (mbrasher@bmc.com)
|
23 mike 1.1 //
|
24 mike 1.10 // Modified By:
|
25 mike 1.9 //
|
26 mike 1.10 //%/////////////////////////////////////////////////////////////////////////////
|
27 mike 1.1
28 #include <cstdio>
29 #include "Exception.h"
30
31 PEGASUS_NAMESPACE_BEGIN
32
33 Exception::Exception(const String& message) : _message(message)
34 {
35
36 }
37
38 Exception::Exception(const char* message) : _message(message)
39 {
40
41 }
42
43 Exception::~Exception()
44 {
45
46 }
47
48 mike 1.1 AssertionFailureException::AssertionFailureException(
49 const char* file,
50 size_t line,
51 const String& message) : Exception(String())
52 {
53 char lineStr[32];
54 sprintf(lineStr, "%d", line);
55
56 _message = file;
57 _message.append("(");
58 _message.append(lineStr);
59 _message.append("): ");
60 _message.append(message);
61 }
62
63 const char OutOfBounds::MSG[] = "out of bounds";
64
65 const char AlreadyExists::MSG[] = "already exists: ";
66
67 const char NullPointer::MSG[] = "null pointer";
68
69 mike 1.1 const char UnitializedHandle::MSG[] = "unitialized reference";
70
71 const char IllegalName::MSG[] = "illegal CIM name";
72
73 const char NoSuchSuperClass::MSG[] = "no such super class: ";
|
74 mike 1.2
75 const char NoSuchClass::MSG[] = "no such class: ";
|
76 mike 1.1
77 const char InvalidPropertyOverride::MSG[] = "invalid property override: ";
78
79 const char InvalidMethodOverride::MSG[] = "invalid method override: ";
80
81 const char UndeclaredQualifier::MSG[] = "undeclared qualifier: ";
82
83 const char BadQualifierScope::MSG[] = "qualifier invalid in this scope: ";
84
85 const char BadQualifierOverride::MSG[] = "qualifier not overridable: ";
86
|
87 mike 1.4 const char BadQualifierType::MSG[] =
|
88 mike 1.7 "CIMType of qualifier different than its declaration: ";
|
89 mike 1.4
|
90 mike 1.1 const char NullType::MSG[] = "type is null";
91
92 const char AddedReferenceToClass::MSG[] =
93 "attempted to add reference to a non-association class: ";
94
95 const char ClassAlreadyResolved::MSG[] =
96 "attempt to resolve a class that is already resolved: ";
97
98 const char ClassNotResolved::MSG[] =
99 "class is not yet resolved: ";
100
101 const char InstanceAlreadyResolved::MSG[] =
102 "attempted to resolve a instance that is already resolved";
103
104 const char InstantiatedAbstractClass::MSG[] =
105 "attempted to instantiated an abstract class";
106
107 const char NoSuchProperty::MSG[] = "no such property: ";
108
109 const char TruncatedCharacter::MSG[] =
110 "truncated character during conversion from Char16 to char";
111 mike 1.1
112 const char ExpectedReferenceValue::MSG[] =
|
113 mike 1.7 "Expected CIMValue object to be CIMType::REFERENCE or CIMType::REFERENCE_ARRAY "
|
114 mike 1.1 "in this context";
115
116 const char MissingReferenceClassName::MSG[] = "missing reference class name";
117
118 const char IllegalTypeTag::MSG[] = "illegal type tag";
119
120 const char TypeMismatch::MSG[] = "type mismatch";
121
122 const char NoSuchFile::MSG[] = "no such file: ";
123
124 const char NoSuchDirectory::MSG[] = "no such directory: ";
125
126 const char ChangeDirectoryFailed::MSG[] = "failed to change directory: ";
127
128 const char CannotCreateDirectory::MSG[] = "cannot create directory: ";
129
130 const char NoSuchNameSpace::MSG[] = "no such namespace: ";
131
132 const char CannotOpenFile::MSG[] = "cannot open file: ";
133
134 const char NotImplemented::MSG[] = "not implemented: ";
135 mike 1.1
136 const char FailedToRemoveDirectory::MSG[] = "failed to remove directory: ";
137
138 const char FailedToRemoveFile::MSG[] = "failed to remove file: ";
139
140 const char StackUnderflow::MSG[] = "stack overflow";
141
142 const char BadFormat::MSG[] = "bad format passed to Formatter::format()";
143
144 const char BadDateTimeFormat::MSG[] = "bad datetime format";
145
146 const char IncompatibleTypes::MSG[] = "incompatible types";
147
148 const char BadlyFormedCGIQueryString::MSG[] = "badly formed CGI query string";
|
149 mike 1.4
|
150 mike 1.9 const char IllformedObjectPath::MSG[] = "illformed object path: ";
|
151 mike 1.5
152 const char DynamicLoadFailed::MSG[] = "load of dynamic library failed: ";
153
154 const char DynamicLookupFailed::MSG[] =
155 "lookup of symbol in dynamic library failed: ";
|
156 mike 1.6
157 const char CannotOpenDirectory::MSG[] = "cannot open directory: ";
|
158 mike 1.1
159 ////////////////////////////////////////////////////////////////////////////////
160 //
|
161 mike 1.8 // CIMException
|
162 mike 1.1 //
163 ////////////////////////////////////////////////////////////////////////////////
164
165 static char* _cimMessages[] =
166 {
167 "successful",
168
169 "A general error occurred that is not covered by a more specific "
170 "error code.",
171
172 "Access to a CIM resource was not available to the client.",
173
174 "The target namespace does not exist.",
175
176 "One or more parameter values passed to the method were invalid.",
177
178 "The specified class does not exist.",
179
180 "The requested object could not be found.",
181
182 "The requested operation is not supported.",
183 mike 1.1
184 "Operation cannot be carried out on this class since it has subclasses.",
185
186 "Operation cannot be carried out on this class since it has instances.",
187
188 "Operation cannot be carried out since the specified "
189 "superClass does not exist.",
190
191 "Operation cannot be carried out because an object already exists.",
192
193 "The specified property does not exist.",
194
195 "The value supplied is incompatible with the type.",
196
197 "The query language is not recognized or supported.",
198
199 "The query is not valid for the specified query language.",
200
201 "The extrinsic method could not be executed.",
202
203 "The specified extrinsic method does not exist."
204 mike 1.1 };
205
|
206 mike 1.8 static String _makeCIMExceptionMessage(
207 CIMException::Code code,
208 const String& extraMessage)
209 {
210 String tmp = _cimMessages[Uint32(code)];
211 tmp.append(": ");
212 tmp.append(extraMessage);
213 return tmp;
214 }
215
216 CIMException::CIMException(
217 CIMException::Code code,
218 const String& extraMessage)
219 : Exception(_makeCIMExceptionMessage(code, extraMessage)), _code(code)
|
220 mike 1.1 {
221
222 }
223
|
224 mike 1.8 const char* CIMException::codeToString(CIMException::Code code)
|
225 mike 1.1 {
226 return _cimMessages[Uint32(code)];
227 }
228
229 PEGASUS_NAMESPACE_END
|