1 mike 1.1 //BEGIN_LICENSE
2 //
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 //END_LICENSE
21 //BEGIN_HISTORY
22 mike 1.1 //
23 // Author:
24 //
|
25 mike 1.2 // $Log: Exception.cpp,v $
|
26 mike 1.5 // Revision 1.4 2001/01/28 04:11:03 mike
27 // fixed qualifier resolution
28 //
|
29 mike 1.4 // Revision 1.3 2001/01/23 01:25:35 mike
30 // Reworked resolve scheme.
31 //
|
32 mike 1.3 // Revision 1.2 2001/01/22 00:45:47 mike
33 // more work on resolve scheme
34 //
|
35 mike 1.2 // Revision 1.1.1.1 2001/01/14 19:51:33 mike
36 // Pegasus import
37 //
|
38 mike 1.1 //
39 //END_HISTORY
40
41 #include <cstdio>
42 #include "Exception.h"
43
44 PEGASUS_NAMESPACE_BEGIN
45
46 Exception::Exception(const String& message) : _message(message)
47 {
48
49 }
50
51 Exception::Exception(const char* message) : _message(message)
52 {
53
54 }
55
56 Exception::~Exception()
57 {
58
59 mike 1.1 }
60
61 AssertionFailureException::AssertionFailureException(
62 const char* file,
63 size_t line,
64 const String& message) : Exception(String())
65 {
66 char lineStr[32];
67 sprintf(lineStr, "%d", line);
68
69 _message = file;
70 _message.append("(");
71 _message.append(lineStr);
72 _message.append("): ");
73 _message.append(message);
74 }
75
76 const char OutOfBounds::MSG[] = "out of bounds";
77
78 const char AlreadyExists::MSG[] = "already exists: ";
79
80 mike 1.1 const char NullPointer::MSG[] = "null pointer";
81
82 const char UnitializedHandle::MSG[] = "unitialized reference";
83
84 const char IllegalName::MSG[] = "illegal CIM name";
85
86 const char NoSuchSuperClass::MSG[] = "no such super class: ";
|
87 mike 1.2
88 const char NoSuchClass::MSG[] = "no such class: ";
|
89 mike 1.1
90 const char InvalidPropertyOverride::MSG[] = "invalid property override: ";
91
92 const char InvalidMethodOverride::MSG[] = "invalid method override: ";
93
94 const char UndeclaredQualifier::MSG[] = "undeclared qualifier: ";
95
96 const char BadQualifierScope::MSG[] = "qualifier invalid in this scope: ";
97
98 const char BadQualifierOverride::MSG[] = "qualifier not overridable: ";
99
|
100 mike 1.4 const char BadQualifierType::MSG[] =
101 "Type of qualifier different than its declaration: ";
102
|
103 mike 1.1 const char NullType::MSG[] = "type is null";
104
105 const char AddedReferenceToClass::MSG[] =
106 "attempted to add reference to a non-association class: ";
107
108 const char ClassAlreadyResolved::MSG[] =
109 "attempt to resolve a class that is already resolved: ";
110
111 const char ClassNotResolved::MSG[] =
112 "class is not yet resolved: ";
113
114 const char InstanceAlreadyResolved::MSG[] =
115 "attempted to resolve a instance that is already resolved";
116
117 const char InstantiatedAbstractClass::MSG[] =
118 "attempted to instantiated an abstract class";
119
120 const char NoSuchProperty::MSG[] = "no such property: ";
121
122 const char TruncatedCharacter::MSG[] =
123 "truncated character during conversion from Char16 to char";
124 mike 1.1
125 const char ExpectedReferenceValue::MSG[] =
126 "Expected Value object to be Type::REFERENCE or Type::REFERENCE_ARRAY "
127 "in this context";
128
129 const char MissingReferenceClassName::MSG[] = "missing reference class name";
130
131 const char IllegalTypeTag::MSG[] = "illegal type tag";
132
133 const char TypeMismatch::MSG[] = "type mismatch";
134
135 const char NoSuchFile::MSG[] = "no such file: ";
136
137 const char NoSuchDirectory::MSG[] = "no such directory: ";
138
139 const char ChangeDirectoryFailed::MSG[] = "failed to change directory: ";
140
141 const char CannotCreateDirectory::MSG[] = "cannot create directory: ";
142
143 const char NoSuchNameSpace::MSG[] = "no such namespace: ";
144
145 mike 1.1 const char CannotOpenFile::MSG[] = "cannot open file: ";
146
147 const char NotImplemented::MSG[] = "not implemented: ";
148
149 const char FailedToRemoveDirectory::MSG[] = "failed to remove directory: ";
150
151 const char FailedToRemoveFile::MSG[] = "failed to remove file: ";
152
153 const char StackUnderflow::MSG[] = "stack overflow";
154
155 const char BadFormat::MSG[] = "bad format passed to Formatter::format()";
156
157 const char BadDateTimeFormat::MSG[] = "bad datetime format";
158
159 const char IncompatibleTypes::MSG[] = "incompatible types";
160
161 const char BadlyFormedCGIQueryString::MSG[] = "badly formed CGI query string";
|
162 mike 1.4
163 const char BadInstanceName::MSG[] = "bad instance name: ";
|
164 mike 1.5
165 const char DynamicLoadFailed::MSG[] = "load of dynamic library failed: ";
166
167 const char DynamicLookupFailed::MSG[] =
168 "lookup of symbol in dynamic library failed: ";
|
169 mike 1.1
170 ////////////////////////////////////////////////////////////////////////////////
171 //
172 // CimException
173 //
174 ////////////////////////////////////////////////////////////////////////////////
175
176 static char* _cimMessages[] =
177 {
178 "successful",
179
180 "A general error occurred that is not covered by a more specific "
181 "error code.",
182
183 "Access to a CIM resource was not available to the client.",
184
185 "The target namespace does not exist.",
186
187 "One or more parameter values passed to the method were invalid.",
188
189 "The specified class does not exist.",
190 mike 1.1
191 "The requested object could not be found.",
192
193 "The requested operation is not supported.",
194
195 "Operation cannot be carried out on this class since it has subclasses.",
196
197 "Operation cannot be carried out on this class since it has instances.",
198
199 "Operation cannot be carried out since the specified "
200 "superClass does not exist.",
201
202 "Operation cannot be carried out because an object already exists.",
203
204 "The specified property does not exist.",
205
206 "The value supplied is incompatible with the type.",
207
208 "The query language is not recognized or supported.",
209
210 "The query is not valid for the specified query language.",
211 mike 1.1
212 "The extrinsic method could not be executed.",
213
214 "The specified extrinsic method does not exist."
215 };
216
217 CimException::CimException(CimException::Code code)
218 : Exception(_cimMessages[Uint32(code)]), _code(code)
219 {
220
221 }
222
223 const char* CimException::codeToString(CimException::Code code)
224 {
225 return _cimMessages[Uint32(code)];
226 }
227
228 PEGASUS_NAMESPACE_END
|