1 martin 1.29 //%LICENSE////////////////////////////////////////////////////////////////
|
2 martin 1.30 //
|
3 martin 1.29 // Licensed to The Open Group (TOG) under one or more contributor license
4 // agreements. Refer to the OpenPegasusNOTICE.txt file distributed with
5 // this work for additional information regarding copyright ownership.
6 // Each contributor licenses this file to you under the OpenPegasus Open
7 // Source License; you may not use this file except in compliance with the
8 // License.
|
9 martin 1.30 //
|
10 martin 1.29 // Permission is hereby granted, free of charge, to any person obtaining a
11 // copy of this software and associated documentation files (the "Software"),
12 // to deal in the Software without restriction, including without limitation
13 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
14 // and/or sell copies of the Software, and to permit persons to whom the
15 // Software is furnished to do so, subject to the following conditions:
|
16 martin 1.30 //
|
17 martin 1.29 // The above copyright notice and this permission notice shall be included
18 // in all copies or substantial portions of the Software.
|
19 martin 1.30 //
|
20 martin 1.29 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
21 martin 1.30 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
22 martin 1.29 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
23 // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
24 // CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
25 // TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
26 // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
27 martin 1.30 //
|
28 martin 1.29 //////////////////////////////////////////////////////////////////////////
|
29 kumpf 1.1 //
30 //%/////////////////////////////////////////////////////////////////////////////
31
32 #ifndef Pegasus_InternalException_h
33 #define Pegasus_InternalException_h
34
35 #include <Pegasus/Common/Config.h>
36 #include <Pegasus/Common/Linkage.h>
37 #include <Pegasus/Common/Exception.h>
|
38 jim.wunderlich 1.14 #include <Pegasus/Common/PegasusAssert.h>
39
|
40 kumpf 1.1 PEGASUS_NAMESPACE_BEGIN
41
42 /** Class AssertionFailureException
43 This is an Exception class tied to the definiton of an assert named
44 PEGASUS_ASSERT. This assertion can be included at any point in Pegasus
45 code
46 */
47 class PEGASUS_COMMON_LINKAGE AssertionFailureException : public Exception
48 {
49 public:
50
51 AssertionFailureException(
|
52 kumpf 1.21 const char* file,
53 size_t line,
54 const String& message);
|
55 mike 1.19
56 virtual ~AssertionFailureException();
|
57 kumpf 1.1 };
58
59
60 /* Macro to Create the equivalent of an assert but without the
61 termination. This can be used as a temporary marker for asserts
62 that are not working. Prints out the error but continues.
63 NOTE: This is useful in test programs to keep us aware that we
64 have problems without halting the test sequence.
65 This was created primarily to put temporary asserts into tests that
66 are not yet working correctly but will not stop the test sequence.
67 */
68 #define ASSERTTEMP(COND) \
69 do \
70 { \
|
71 kumpf 1.21 if (!(COND)) \
72 { \
73 cerr << "TEMP Assert Error TEMP **********" \
74 <<__FILE__ << " " << __LINE__ \
75 << " " << #COND << endl; \
76 } \
|
77 kumpf 1.1 } while (0)
78
79
80 // ATTN: P3 KS documentation Required
81 class PEGASUS_COMMON_LINKAGE NullPointer : public Exception
82 {
83 public:
84
85 static const char MSG[];
|
86 kumpf 1.22 static const char KEY[];
|
87 kumpf 1.1
|
88 mike 1.19 NullPointer();
|
89 chuck 1.5
|
90 mike 1.19 virtual ~NullPointer();
|
91 kumpf 1.1 };
92
93 // ATTN: P3 KS documentation Required
94 class PEGASUS_COMMON_LINKAGE UndeclaredQualifier : public Exception
95 {
96 public:
97
98 static const char MSG[];
|
99 kumpf 1.22 static const char KEY[];
|
100 kumpf 1.1
|
101 mike 1.19 UndeclaredQualifier(const String& qualifierName) ;
|
102 chuck 1.5
|
103 mike 1.19 virtual ~UndeclaredQualifier();
|
104 kumpf 1.1 };
105
106 // ATTN: P3 KS documentation Required
107 class PEGASUS_COMMON_LINKAGE BadQualifierScope : public Exception
108 {
109 public:
110
|
111 kumpf 1.22 static const char MSG[];
112 static const char KEY[];
|
113 kumpf 1.1
|
114 mike 1.19 BadQualifierScope(
|
115 kumpf 1.22 const String& qualifierName,
|
116 kumpf 1.21 const String& scopeString);
|
117 chuck 1.5
|
118 mike 1.19 virtual ~BadQualifierScope();
|
119 kumpf 1.1 };
120
121 // ATTN: P3 KS documentation Required
122 class PEGASUS_COMMON_LINKAGE BadQualifierOverride : public Exception
123 {
124 public:
125
126 static const char MSG[];
|
127 kumpf 1.22 static const char KEY[];
|
128 kumpf 1.1
|
129 mike 1.19 BadQualifierOverride(const String& qualifierName);
130
131 virtual ~BadQualifierOverride();
|
132 kumpf 1.1 };
133
134 class PEGASUS_COMMON_LINKAGE BadQualifierType : public Exception
135 {
136 public:
137
138 static const char MSG[];
|
139 kumpf 1.22 static const char KEY[];
|
140 kumpf 1.1
|
141 mike 1.19 BadQualifierType(const String& qualifierName);
142 virtual ~BadQualifierType();
|
143 kumpf 1.1 };
144
145 // ATTN: P3 KS documentation Required
146 class PEGASUS_COMMON_LINKAGE InstantiatedAbstractClass : public Exception
147 {
148 public:
149
150 static const char MSG[];
|
151 kumpf 1.22 static const char KEY[];
|
152 kumpf 1.1
|
153 mike 1.19 InstantiatedAbstractClass(const String& className);
154 virtual ~InstantiatedAbstractClass();
|
155 kumpf 1.1 };
156
157 // ATTN: P3 KS documentation Required
158 class PEGASUS_COMMON_LINKAGE NoSuchProperty : public Exception
159 {
160 public:
161
162 static const char MSG[];
|
163 kumpf 1.22 static const char KEY[];
|
164 kumpf 1.1
|
165 mike 1.19 NoSuchProperty(const String& propertyName);
166 virtual ~NoSuchProperty();
|
167 kumpf 1.1 };
168
169 // ATTN: P3 KS documentation Required
170 class PEGASUS_COMMON_LINKAGE NoSuchFile : public Exception
171 {
172 public:
173
174 static const char MSG[];
|
175 kumpf 1.22 static const char KEY[];
|
176 kumpf 1.1
|
177 mike 1.19 NoSuchFile(const String& fileName);
178 virtual ~NoSuchFile();
|
179 kumpf 1.1 };
180
181 // ATTN: P3 KS documentation Required
182 class PEGASUS_COMMON_LINKAGE FileNotReadable : public Exception
183 {
184 public:
185
186 static const char MSG[];
|
187 kumpf 1.22 static const char KEY[];
|
188 kumpf 1.1
|
189 mike 1.19 FileNotReadable(const String& fileName);
190 virtual ~FileNotReadable();
|
191 kumpf 1.1 };
192
193 // ATTN: P3 KS documentation Required
194 class PEGASUS_COMMON_LINKAGE CannotRemoveDirectory : public Exception
195 {
196 public:
197
198 static const char MSG[];
|
199 kumpf 1.22 static const char KEY[];
|
200 kumpf 1.1
|
201 mike 1.19 CannotRemoveDirectory(const String& path);
202 virtual ~CannotRemoveDirectory();
|
203 kumpf 1.1 };
204
205 // ATTN: P3 KS documentation Required
206 class PEGASUS_COMMON_LINKAGE CannotRemoveFile : public Exception
207 {
208 public:
209
210 static const char MSG[];
|
211 kumpf 1.22 static const char KEY[];
|
212 kumpf 1.1
|
213 mike 1.19 CannotRemoveFile(const String& path);
214 virtual ~CannotRemoveFile();
|
215 kumpf 1.1 };
216
217 // ATTN: P3 KS documentation Required
218 class PEGASUS_COMMON_LINKAGE CannotRenameFile : public Exception
219 {
220 public:
221
222 static const char MSG[];
|
223 kumpf 1.22 static const char KEY[];
|
224 kumpf 1.1
|
225 mike 1.19 CannotRenameFile(const String& path);
226 virtual ~CannotRenameFile();
|
227 kumpf 1.1 };
228
229 // ATTN: P3 KS documentation Required
230 class PEGASUS_COMMON_LINKAGE NoSuchDirectory : public Exception
231 {
232 public:
233
234 static const char MSG[];
|
235 kumpf 1.22 static const char KEY[];
|
236 kumpf 1.1
|
237 mike 1.19 NoSuchDirectory(const String& directoryName);
238 virtual ~NoSuchDirectory();
|
239 kumpf 1.1 };
240
241 // ATTN: P3 KS documentation Required
242 class PEGASUS_COMMON_LINKAGE CannotCreateDirectory : public Exception
243 {
244 public:
245
246 static const char MSG[];
|
247 kumpf 1.22 static const char KEY[];
|
248 kumpf 1.1
|
249 mike 1.19 CannotCreateDirectory(const String& path);
250 virtual ~CannotCreateDirectory();
|
251 kumpf 1.1 };
252
253 // ATTN: P3 KS documentation Required
254 class PEGASUS_COMMON_LINKAGE CannotOpenFile : public Exception
255 {
256 public:
257
258 static const char MSG[];
|
259 kumpf 1.22 static const char KEY[];
|
260 kumpf 1.1
|
261 mike 1.19 CannotOpenFile(const String& path);
262 virtual ~CannotOpenFile();
|
263 kumpf 1.1 };
264
265 // ATTN: P3 KS documentation Required
266 class PEGASUS_COMMON_LINKAGE NotImplemented : public Exception
267 {
268 public:
269
270 static const char MSG[];
|
271 kumpf 1.22 static const char KEY[];
|
272 kumpf 1.1
|
273 mike 1.19 NotImplemented(const String& method);
274 virtual ~NotImplemented();
|
275 kumpf 1.1 };
276
277 class PEGASUS_COMMON_LINKAGE StackUnderflow : public Exception
278 {
279 public:
280
281 static const char MSG[];
|
282 kumpf 1.22 static const char KEY[];
|
283 kumpf 1.1
|
284 mike 1.19 StackUnderflow();
285 virtual ~StackUnderflow();
|
286 kumpf 1.1 };
287
288 class PEGASUS_COMMON_LINKAGE StackOverflow : public Exception
289 {
290 public:
291
292 static const char MSG[];
|
293 kumpf 1.22 static const char KEY[];
|
294 kumpf 1.1
|
295 mike 1.19 StackOverflow();
296 virtual ~StackOverflow();
|
297 kumpf 1.1 };
298
299 class PEGASUS_COMMON_LINKAGE DynamicLoadFailed : public Exception
300 {
301 public:
302
303 static const char MSG[];
|
304 kumpf 1.22 static const char KEY[];
|
305 kumpf 1.1
|
306 mike 1.19 DynamicLoadFailed(const String& libraryName);
307 virtual ~DynamicLoadFailed();
|
308 kumpf 1.1 };
309
310 class PEGASUS_COMMON_LINKAGE DynamicLookupFailed : public Exception
311 {
312 public:
313
314 static const char MSG[];
|
315 kumpf 1.22 static const char KEY[];
|
316 kumpf 1.1
|
317 mike 1.19 DynamicLookupFailed(const String& symbolName);
318 virtual ~DynamicLookupFailed();
|
319 kumpf 1.1 };
320
321 class PEGASUS_COMMON_LINKAGE CannotOpenDirectory : public Exception
322 {
323 public:
324
325 static const char MSG[];
|
326 kumpf 1.22 static const char KEY[];
|
327 kumpf 1.1
|
328 mike 1.19 CannotOpenDirectory(const String& path);
329 virtual ~CannotOpenDirectory();
|
330 kumpf 1.1 };
331
332 class PEGASUS_COMMON_LINKAGE ParseError : public Exception
333 {
334 public:
335
336 static const char MSG[];
|
337 kumpf 1.22 static const char KEY[];
|
338 kumpf 1.1
|
339 mike 1.19 ParseError(const String& message);
340 virtual ~ParseError();
|
341 kumpf 1.1 };
342
343 class PEGASUS_COMMON_LINKAGE MissingNullTerminator : public Exception
344 {
345 public:
346
347 static const char MSG[];
|
348 kumpf 1.22 static const char KEY[];
|
349 kumpf 1.1
|
350 mike 1.19 MissingNullTerminator();
351 virtual ~MissingNullTerminator();
|
352 chuck 1.5 };
353
354 class PEGASUS_COMMON_LINKAGE MalformedLanguageHeader: public Exception
355 {
356 public:
357
358 static const char MSG[];
|
359 kumpf 1.22 static const char KEY[];
|
360 chuck 1.5
|
361 mike 1.19 MalformedLanguageHeader(const String& error);
362 virtual ~MalformedLanguageHeader();
|
363 chuck 1.5 };
364
365 class PEGASUS_COMMON_LINKAGE InvalidAcceptLanguageHeader: public Exception
366 {
367 public:
368
369 static const char MSG[];
|
370 kumpf 1.22 static const char KEY[];
|
371 chuck 1.5
|
372 mike 1.19 InvalidAcceptLanguageHeader(const String& error);
373 virtual ~InvalidAcceptLanguageHeader();
|
374 kumpf 1.1 };
375
|
376 chuck 1.5 class PEGASUS_COMMON_LINKAGE InvalidContentLanguageHeader: public Exception
377 {
378 public:
379
380 static const char MSG[];
|
381 kumpf 1.22 static const char KEY[];
|
382 chuck 1.5
|
383 mike 1.19 InvalidContentLanguageHeader(const String& error);
384 virtual ~InvalidContentLanguageHeader();
|
385 chuck 1.5 };
386
|
387 kumpf 1.1 class PEGASUS_COMMON_LINKAGE InvalidAuthHeader: public Exception
388 {
389 public:
390
391 static const char MSG[];
|
392 kumpf 1.22 static const char KEY[];
|
393 kumpf 1.1
|
394 mike 1.19 InvalidAuthHeader();
395 virtual ~InvalidAuthHeader();
|
396 kumpf 1.1 };
397
398 class PEGASUS_COMMON_LINKAGE UnauthorizedAccess: public Exception
399 {
400 public:
401
402 static const char MSG[];
|
403 kumpf 1.22 static const char KEY[];
|
404 kumpf 1.1
|
405 mike 1.19 UnauthorizedAccess();
406 virtual ~UnauthorizedAccess();
|
407 kumpf 1.1 };
408
|
409 kumpf 1.4 class PEGASUS_COMMON_LINKAGE IncompatibleTypesException : public Exception
410 {
411 public:
|
412 kumpf 1.22 IncompatibleTypesException();
413 virtual ~IncompatibleTypesException();
|
414 kumpf 1.4 };
415
|
416 kumpf 1.10 class PEGASUS_COMMON_LINKAGE InternalSystemError : public Exception
417 {
418 public:
419
420 static const char MSG[];
421
|
422 mike 1.19 InternalSystemError();
423 virtual ~InternalSystemError();
|
424 kumpf 1.10 };
425
|
426 kumpf 1.4
|
427 kumpf 1.1 /** The CIMException defines the CIM exceptions that are formally defined in
|
428 kumpf 1.2 the CIM Operations over HTTP specification. TraceableCIMException allows
|
429 kumpf 1.1 file name and line number information to be added for diagnostic purposes.
430 */
|
431 kumpf 1.2 class PEGASUS_COMMON_LINKAGE TraceableCIMException : public CIMException
|
432 kumpf 1.1 {
433 public:
434
|
435 kumpf 1.2 TraceableCIMException(
|
436 kumpf 1.21 CIMStatusCode code,
437 const String& message,
438 const String& file,
439 Uint32 line);
440
441 TraceableCIMException(
442 CIMStatusCode code,
|
443 kumpf 1.23 const MessageLoaderParms& parms,
|
444 kumpf 1.21 const String& file,
445 Uint32 line);
446
447 TraceableCIMException(
448 const ContentLanguageList& langs,
449 CIMStatusCode code,
450 const String& message,
451 const String& file,
452 Uint32 line);
|
453 chuck 1.5
|
454 kumpf 1.2 TraceableCIMException(const CIMException & cimException);
455
456 String getDescription() const;
|
457 kumpf 1.1
458 String getTraceDescription() const;
|
459 kumpf 1.11
460 String getCIMMessage() const;
461 void setCIMMessage(const String& cimMessage);
462
463 String getFile() const;
464 Uint32 getLine() const;
|
465 kumpf 1.16 const ContentLanguageList& getContentLanguages() const;
|
466 kumpf 1.2 };
|
467 kumpf 1.1
|
468 kumpf 1.2 #define PEGASUS_CIM_EXCEPTION(CODE, EXTRA_MESSAGE) \
|
469 kumpf 1.11 TraceableCIMException(CODE, EXTRA_MESSAGE, String(__FILE__), __LINE__)
|
470 chuck 1.5
471 #define PEGASUS_CIM_EXCEPTION_LANG(LANGS, CODE, EXTRA_MESSAGE) \
|
472 kumpf 1.11 TraceableCIMException( \
|
473 kumpf 1.22 LANGS, CODE, EXTRA_MESSAGE, String(__FILE__), __LINE__)
474
|
475 humberto 1.7 #define PEGASUS_CIM_EXCEPTION_L(CODE, MSG_PARMS) \
|
476 kumpf 1.11 TraceableCIMException(CODE, MSG_PARMS, String(__FILE__), __LINE__)
|
477 kumpf 1.1
|
478 kumpf 1.22 /** Macro to prevent overflow of a signed int value when said value is
|
479 dave.sudlik 1.18 * doubled. If String/Array/Buffer size is greater than 0x3FFFFFFF, then
480 * something is suspect, throw bad_alloc exception.
481 */
482 #define PEGASUS_CHECK_CAPACITY_OVERFLOW(capacity) \
483 do \
484 { \
485 if (capacity > 0x3FFFFFFF) \
486 throw PEGASUS_STD(bad_alloc)(); \
487 } \
488 while (0)
489
|
490 marek 1.25 /** The following function CheckRep serves to reduce the function call
491 * overhead caused by calling a non-inlined function that only checks
492 * if a pointer is not NULL.
|
493 kumpf 1.31 * The function ThrowUnitializedObjectException throws
|
494 marek 1.25 * an UninitialisedObjectException.
495 * A function to throw the exception is used to reduce object size of
496 * function CheckRep which is inlined in many places across
497 * the common library.
498 */
499 PEGASUS_COMMON_LINKAGE extern void ThrowUninitializedObjectException();
500
501 inline void CheckRep(void * rep)
502 {
|
503 kumpf 1.31 if (!rep)
|
504 marek 1.25 ThrowUninitializedObjectException();
|
505 dmitry.mikulin 1.28 }
|
506 marek 1.25
|
507 kumpf 1.1 PEGASUS_NAMESPACE_END
508
509 #endif /* Pegasus_InternalException_h */
|