1 kumpf 1.1 //%/////////////////////////////////////////////////////////////////////////////
2 //
3 // Copyright (c) 2000, 2001, 2002 BMC Software, Hewlett-Packard Company, IBM,
4 // The Open Group, Tivoli Systems
5 //
6 // Permission is hereby granted, free of charge, to any person obtaining a copy
7 // of this software and associated documentation files (the "Software"), to
8 // deal in the Software without restriction, including without limitation the
9 // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
10 // sell copies of the Software, and to permit persons to whom the Software is
11 // furnished to do so, subject to the following conditions:
12 //
13 // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
14 // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
15 // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
16 // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
17 // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
18 // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
19 // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 //
22 kumpf 1.1 //==============================================================================
23 //
24 // Author: Roger Kumpf, Hewlett-Packard Company (roger_kumpf@hp.com)
25 //
26 // Modified By:
27 //
28 //%/////////////////////////////////////////////////////////////////////////////
29
30 #ifndef Pegasus_InternalException_h
31 #define Pegasus_InternalException_h
32
33 #include <Pegasus/Common/Config.h>
34 #include <Pegasus/Common/Linkage.h>
35 #include <Pegasus/Common/Exception.h>
36
37 PEGASUS_NAMESPACE_BEGIN
38
39 /** Class AssertionFailureException
40 This is an Exception class tied to the definiton of an assert named
41 PEGASUS_ASSERT. This assertion can be included at any point in Pegasus
42 code
43 kumpf 1.1 */
44 class PEGASUS_COMMON_LINKAGE AssertionFailureException : public Exception
45 {
46 public:
47
48 AssertionFailureException(
49 const char* file,
50 size_t line,
51 const String& message);
52 };
53
54 /** define PEGASUS_ASSERT assertion statement. This statement tests the
55 condition defined by the parameters and if not True executes an
56
57 <pre>
58 throw AssertionFailureException
59 </pre>
60
61 defining the file, line and condition that was tested.
62 */
63 #ifdef NDEBUG
64 kumpf 1.1 #define PEGASUS_ASSERT(COND)
65 #else
66 #define PEGASUS_ASSERT(COND) \
67 do \
68 { \
69 if (!(COND)) \
70 { \
71 throw AssertionFailureException(__FILE__, __LINE__, #COND); \
72 } \
73 } while (0)
74 #endif
75
76 /* Macro to Create the equivalent of an assert but without the
77 termination. This can be used as a temporary marker for asserts
78 that are not working. Prints out the error but continues.
79 NOTE: This is useful in test programs to keep us aware that we
80 have problems without halting the test sequence.
81 This was created primarily to put temporary asserts into tests that
82 are not yet working correctly but will not stop the test sequence.
83 */
84 #define ASSERTTEMP(COND) \
85 kumpf 1.1 do \
86 { \
87 if (!(COND)) \
88 { \
89 cerr << "TEMP Assert Error TEMP **********" \
90 <<__FILE__ << " " << __LINE__ \
91 << " " << #COND << endl; \
92 } \
93 } while (0)
94
95
|
96 chuck 1.5 // l10n TODO - finish the commented out constructors
97
|
98 kumpf 1.1 // ATTN: P3 KS documentation Required
99 class PEGASUS_COMMON_LINKAGE NullPointer : public Exception
100 {
101 public:
102
103 static const char MSG[];
|
104 chuck 1.6 static const char KEY[];
|
105 kumpf 1.1
|
106 chuck 1.6 //NullPointer() : Exception(MSG) { }
|
107 chuck 1.5
|
108 chuck 1.6 NullPointer() : Exception(MessageLoaderParms(KEY, MSG)) { }
|
109 kumpf 1.1 };
110
111 // ATTN: P3 KS documentation Required
112 class PEGASUS_COMMON_LINKAGE UndeclaredQualifier : public Exception
113 {
114 public:
115
116 static const char MSG[];
|
117 chuck 1.6 static const char KEY[];
|
118 kumpf 1.1
|
119 chuck 1.6 //UndeclaredQualifier(const String& qualifierName)
120 //: Exception(MSG + qualifierName) { }
|
121 chuck 1.5
122 // NOTE - MSG needs to have a $0 arg for all the substitution cases
|
123 chuck 1.6 UndeclaredQualifier(const String& qualifierName)
124 : Exception(MessageLoaderParms(KEY, MSG, qualifierName)) { }
|
125 kumpf 1.1 };
126
127 // ATTN: P3 KS documentation Required
128 class PEGASUS_COMMON_LINKAGE BadQualifierScope : public Exception
129 {
130 public:
131
|
132 chuck 1.6 static const char MSG[];
133 static const char KEY[];
|
134 kumpf 1.1
|
135 chuck 1.6 //BadQualifierScope(const String& qualifierName, const String& scopeString)
136 //: Exception(MSG + qualifierName + String(" scope=") + scopeString) { }
|
137 chuck 1.5
|
138 chuck 1.6
|
139 chuck 1.5 BadQualifierScope(const String& qualifierName, const String& scopeString)
140 : Exception(MessageLoaderParms(KEY,
141 MSG,
142 qualifierName,
143 scopeString)) { }
|
144 chuck 1.6
|
145 kumpf 1.1 };
146
147 // ATTN: P3 KS documentation Required
148 class PEGASUS_COMMON_LINKAGE BadQualifierOverride : public Exception
149 {
150 public:
151
152 static const char MSG[];
|
153 chuck 1.6 static const char KEY[];
|
154 kumpf 1.1
|
155 chuck 1.6 //BadQualifierOverride(const String& qualifierName)
156 //: Exception(MSG + qualifierName) { }
157
|
158 kumpf 1.1 BadQualifierOverride(const String& qualifierName)
|
159 chuck 1.6 : Exception(MessageLoaderParms(KEY, MSG, qualifierName)) { }
|
160 kumpf 1.1 };
161
162 class PEGASUS_COMMON_LINKAGE BadQualifierType : public Exception
163 {
164 public:
165
166 static const char MSG[];
|
167 chuck 1.6 static const char KEY[];
|
168 kumpf 1.1
|
169 chuck 1.6 //BadQualifierType(const String& qualifierName)
170 //: Exception(MSG + qualifierName) { }
|
171 chuck 1.5
|
172 chuck 1.6 BadQualifierType(const String& qualifierName)
173 : Exception(MessageLoaderParms(KEY, MSG, qualifierName)) { }
|
174 kumpf 1.1 };
175
176 // ATTN: P3 KS documentation Required
177 class PEGASUS_COMMON_LINKAGE ClassAlreadyResolved : public Exception
178 {
179 public:
180
181 static const char MSG[];
|
182 chuck 1.6 static const char KEY[];
|
183 kumpf 1.1
|
184 chuck 1.6 //ClassAlreadyResolved(const String& className)
185 //: Exception(MSG + className) { }
|
186 chuck 1.5
|
187 chuck 1.6 ClassAlreadyResolved(const String& className)
188 : Exception(MessageLoaderParms(KEY, MSG, className)) { }
|
189 kumpf 1.1 };
190
191 // ATTN: P3 KS documentation Required
192 class PEGASUS_COMMON_LINKAGE ClassNotResolved : public Exception
193 {
194 public:
195
196 static const char MSG[];
|
197 chuck 1.6 static const char KEY[];
|
198 kumpf 1.1
|
199 chuck 1.6 //ClassNotResolved(const String& className)
200 //: Exception(MSG + className) { }
|
201 chuck 1.5
|
202 chuck 1.6 ClassNotResolved(const String& className)
203 : Exception(MessageLoaderParms(KEY, MSG, className)) { }
|
204 kumpf 1.1 };
205
206 // ATTN: P3 KS documentation Required
207 class PEGASUS_COMMON_LINKAGE InstanceAlreadyResolved : public Exception
208 {
209 public:
210
211 static const char MSG[];
|
212 chuck 1.6 static const char KEY[];
|
213 kumpf 1.1
|
214 chuck 1.6 //InstanceAlreadyResolved()
215 // : Exception(MSG) { }
|
216 chuck 1.5
|
217 chuck 1.6 InstanceAlreadyResolved()
218 : Exception(MessageLoaderParms(KEY, MSG)) { }
|
219 kumpf 1.1 };
220
221 // ATTN: P3 KS documentation Required
222 class PEGASUS_COMMON_LINKAGE InstantiatedAbstractClass : public Exception
223 {
224 public:
225
226 static const char MSG[];
|
227 chuck 1.6 static const char KEY[];
|
228 kumpf 1.1
|
229 chuck 1.6 //InstantiatedAbstractClass(const String& className)
230 //: Exception(MSG + className) { }
|
231 chuck 1.5
|
232 chuck 1.6 InstantiatedAbstractClass(const String& className)
233 : Exception(MessageLoaderParms(KEY, MSG, className)) { }
|
234 kumpf 1.1 };
235
236 // ATTN: P3 KS documentation Required
237 class PEGASUS_COMMON_LINKAGE NoSuchProperty : public Exception
238 {
239 public:
240
241 static const char MSG[];
|
242 chuck 1.6 static const char KEY[];
|
243 kumpf 1.1
|
244 chuck 1.6 //NoSuchProperty(const String& propertyName)
245 //: Exception(MSG + propertyName) { }
|
246 chuck 1.5
|
247 chuck 1.6 NoSuchProperty(const String& propertyName)
248 : Exception(MessageLoaderParms(KEY, MSG, propertyName)) { }
|
249 kumpf 1.1 };
250
251 // ATTN: P3 KS documentation Required
252 class PEGASUS_COMMON_LINKAGE NoSuchFile : public Exception
253 {
254 public:
255
256 static const char MSG[];
|
257 chuck 1.6 static const char KEY[];
|
258 kumpf 1.1
|
259 chuck 1.6 // NoSuchFile(const String& fileName) : Exception(MSG + fileName) { }
|
260 chuck 1.5
|
261 chuck 1.6 NoSuchFile(const String& fileName)
262 : Exception(MessageLoaderParms(KEY, MSG, fileName)) { }
|
263 kumpf 1.1 };
264
265 // ATTN: P3 KS documentation Required
266 class PEGASUS_COMMON_LINKAGE FileNotReadable : public Exception
267 {
268 public:
269
270 static const char MSG[];
|
271 chuck 1.6 static const char KEY[];
|
272 kumpf 1.1
|
273 chuck 1.6 //FileNotReadable(const String& fileName) : Exception(MSG + fileName) { }
|
274 chuck 1.5
|
275 chuck 1.6 FileNotReadable(const String& fileName)
276 : Exception(MessageLoaderParms(KEY, MSG, fileName)) { }
|
277 kumpf 1.1 };
278
279 // ATTN: P3 KS documentation Required
280 class PEGASUS_COMMON_LINKAGE CannotRemoveDirectory : public Exception
281 {
282 public:
283
284 static const char MSG[];
|
285 chuck 1.6 static const char KEY[];
|
286 kumpf 1.1
|
287 chuck 1.6 //CannotRemoveDirectory(const String& path) : Exception(MSG + path) { }
|
288 chuck 1.5
|
289 chuck 1.6 CannotRemoveDirectory(const String& path)
290 : Exception(MessageLoaderParms(KEY, MSG, path)) { }
|
291 kumpf 1.1 };
292
293 // ATTN: P3 KS documentation Required
294 class PEGASUS_COMMON_LINKAGE CannotRemoveFile : public Exception
295 {
296 public:
297
298 static const char MSG[];
|
299 chuck 1.6 static const char KEY[];
|
300 kumpf 1.1
|
301 chuck 1.6 //CannotRemoveFile(const String& path) : Exception(MSG + path) { }
302 CannotRemoveFile(const String& path)
303 : Exception(MessageLoaderParms(KEY, MSG, path)) { }
|
304 kumpf 1.1 };
305
306 // ATTN: P3 KS documentation Required
307 class PEGASUS_COMMON_LINKAGE CannotRenameFile : public Exception
308 {
309 public:
310
311 static const char MSG[];
|
312 chuck 1.6 static const char KEY[];
|
313 kumpf 1.1
|
314 chuck 1.6 //CannotRenameFile(const String& path) : Exception(MSG + path) { }
315 CannotRenameFile(const String& path)
316 : Exception(MessageLoaderParms(KEY, MSG, path)) { }
|
317 kumpf 1.1 };
318
319 // ATTN: P3 KS documentation Required
320 class PEGASUS_COMMON_LINKAGE NoSuchDirectory : public Exception
321 {
322 public:
323
324 static const char MSG[];
|
325 chuck 1.6 static const char KEY[];
|
326 kumpf 1.1
|
327 chuck 1.6 //NoSuchDirectory(const String& directoryName)
328 //: Exception(MSG + directoryName) { }
329 NoSuchDirectory(const String& directoryName)
330 : Exception(MessageLoaderParms(KEY, MSG, directoryName)) { }
|
331 kumpf 1.1 };
332
333 // ATTN: P3 KS documentation Required
334 class PEGASUS_COMMON_LINKAGE CannotCreateDirectory : public Exception
335 {
336 public:
337
338 static const char MSG[];
|
339 chuck 1.6 static const char KEY[];
|
340 kumpf 1.1
|
341 chuck 1.6 //CannotCreateDirectory(const String& path)
342 //: Exception(MSG + path) { }
343 CannotCreateDirectory(const String& path)
344 : Exception(MessageLoaderParms(KEY, MSG, path)) { }
|
345 kumpf 1.1 };
346
347 // ATTN: P3 KS documentation Required
348 class PEGASUS_COMMON_LINKAGE CannotOpenFile : public Exception
349 {
350 public:
351
352 static const char MSG[];
|
353 chuck 1.6 static const char KEY[];
|
354 kumpf 1.1
|
355 chuck 1.6 //CannotOpenFile(const String& path)
356 //: Exception(MSG + path) { }
357 CannotOpenFile(const String& path)
358 : Exception(MessageLoaderParms(KEY, MSG, path)) { }
|
359 kumpf 1.1 };
360
361 // ATTN: P3 KS documentation Required
362 class PEGASUS_COMMON_LINKAGE NotImplemented : public Exception
363 {
364 public:
365
366 static const char MSG[];
|
367 chuck 1.6 static const char KEY[];
|
368 kumpf 1.1
|
369 chuck 1.6 // NotImplemented(const String& method) : Exception(MSG + method) { }
370 NotImplemented(const String& method)
371 : Exception(MessageLoaderParms(KEY, MSG, method)) { }
|
372 kumpf 1.1 };
373
374 class PEGASUS_COMMON_LINKAGE StackUnderflow : public Exception
375 {
376 public:
377
378 static const char MSG[];
|
379 chuck 1.6 static const char KEY[];
|
380 kumpf 1.1
|
381 chuck 1.6 //StackUnderflow() : Exception(MSG) { }
382 StackUnderflow()
383 : Exception(MessageLoaderParms(KEY, MSG)) { }
|
384 kumpf 1.1 };
385
386 class PEGASUS_COMMON_LINKAGE StackOverflow : public Exception
387 {
388 public:
389
390 static const char MSG[];
|
391 chuck 1.6 static const char KEY[];
|
392 kumpf 1.1
|
393 chuck 1.6 //StackOverflow() : Exception(MSG) { }
394 StackOverflow()
395 : Exception(MessageLoaderParms(KEY, MSG)) { }
|
396 kumpf 1.1 };
397
398 class PEGASUS_COMMON_LINKAGE QueueUnderflow : public Exception
399 {
400 public:
401
402 static const char MSG[];
|
403 chuck 1.6 static const char KEY[];
|
404 kumpf 1.1
|
405 chuck 1.6 //QueueUnderflow() : Exception(MSG) { }
406 QueueUnderflow()
407 : Exception(MessageLoaderParms(KEY, MSG)) { }
|
408 kumpf 1.1 };
409
410 class PEGASUS_COMMON_LINKAGE BadFormat : public Exception
411 {
412 public:
413
414 static const char MSG[];
|
415 chuck 1.6 static const char KEY[];
|
416 kumpf 1.1
|
417 chuck 1.6 //BadFormat() : Exception(MSG) { }
418 BadFormat()
419 : Exception(MessageLoaderParms(KEY, MSG)) { }
|
420 kumpf 1.1 };
421
422 class PEGASUS_COMMON_LINKAGE BadlyFormedCGIQueryString : public Exception
423 {
424 public:
425
426 static const char MSG[];
|
427 chuck 1.6 static const char KEY[];
|
428 kumpf 1.1
|
429 chuck 1.6 //BadlyFormedCGIQueryString() : Exception(MSG) { }
430 BadlyFormedCGIQueryString()
431 : Exception(MessageLoaderParms(KEY, MSG)) { }
|
432 kumpf 1.1 };
433
434 class PEGASUS_COMMON_LINKAGE DynamicLoadFailed : public Exception
435 {
436 public:
437
438 static const char MSG[];
|
439 chuck 1.6 static const char KEY[];
|
440 kumpf 1.1
|
441 chuck 1.6 //DynamicLoadFailed(const String& libraryName)
442 //: Exception(MSG + libraryName) { }
|
443 chuck 1.5
|
444 chuck 1.6 DynamicLoadFailed(const String& libraryName)
445 : Exception(MessageLoaderParms(KEY, MSG, libraryName)) { }
|
446 kumpf 1.1 };
447
448 class PEGASUS_COMMON_LINKAGE DynamicLookupFailed : public Exception
449 {
450 public:
451
452 static const char MSG[];
|
453 chuck 1.6 static const char KEY[];
|
454 kumpf 1.1
|
455 chuck 1.6 //DynamicLookupFailed(const String& symbolName)
456 //: Exception(MSG + symbolName) { }
457 DynamicLookupFailed(const String& symbolName)
458 : Exception(MessageLoaderParms(KEY, MSG, symbolName)) { }
|
459 kumpf 1.1 };
460
461 class PEGASUS_COMMON_LINKAGE CannotOpenDirectory : public Exception
462 {
463 public:
464
465 static const char MSG[];
|
466 chuck 1.6 static const char KEY[];
|
467 kumpf 1.1
|
468 chuck 1.6 //CannotOpenDirectory(const String& path) : Exception(MSG + path) { }
469 CannotOpenDirectory(const String& path)
470 : Exception(MessageLoaderParms(KEY, MSG, path)) { }
|
471 kumpf 1.1 };
472
473 class PEGASUS_COMMON_LINKAGE ParseError : public Exception
474 {
475 public:
476
477 static const char MSG[];
|
478 chuck 1.6 static const char KEY[];
|
479 kumpf 1.1
|
480 chuck 1.6 //ParseError(const String& message) : Exception(MSG + message) { }
481 ParseError(const String& message)
482 : Exception(MessageLoaderParms(KEY, MSG, message)) { }
|
483 kumpf 1.1 };
484
485 class PEGASUS_COMMON_LINKAGE MissingNullTerminator : public Exception
486 {
487 public:
488
489 static const char MSG[];
|
490 chuck 1.6 static const char KEY[];
|
491 kumpf 1.1
|
492 chuck 1.6 //MissingNullTerminator() : Exception(MSG) { }
493 MissingNullTerminator()
494 : Exception(MessageLoaderParms(KEY, MSG)) { }
|
495 chuck 1.5 };
496
497 //l10n start
498
499 class PEGASUS_COMMON_LINKAGE MalformedLanguageHeader: public Exception
500 {
501 public:
502
503 static const char MSG[];
|
504 chuck 1.6 static const char KEY[];
|
505 chuck 1.5
|
506 chuck 1.6 //MalformedLanguageHeader(const String& error) : Exception(MSG + error) { }
507 MalformedLanguageHeader(const String& error)
508 : Exception(MessageLoaderParms(KEY, MSG, error)) { }
|
509 chuck 1.5 };
510
511
512 class PEGASUS_COMMON_LINKAGE InvalidAcceptLanguageHeader: public Exception
513 {
514 public:
515
516 static const char MSG[];
|
517 chuck 1.6 static const char KEY[];
|
518 chuck 1.5
|
519 chuck 1.6 //InvalidAcceptLanguageHeader(const String& error) : Exception(MSG + error) { }
520 InvalidAcceptLanguageHeader(const String& error)
521 : Exception(MessageLoaderParms(KEY, MSG, error)) { }
|
522 kumpf 1.1 };
523
|
524 chuck 1.5 class PEGASUS_COMMON_LINKAGE InvalidContentLanguageHeader: public Exception
525 {
526 public:
527
528 static const char MSG[];
|
529 chuck 1.6 static const char KEY[];
|
530 chuck 1.5
|
531 chuck 1.6 //InvalidContentLanguageHeader(const String& error) : Exception(MSG + error) { }
532 InvalidContentLanguageHeader(const String& error)
533 : Exception(MessageLoaderParms(KEY, MSG, error)) { }
|
534 chuck 1.5 };
535
536 //l10n end
537
|
538 kumpf 1.1 class PEGASUS_COMMON_LINKAGE InvalidAuthHeader: public Exception
539 {
540 public:
541
542 static const char MSG[];
|
543 chuck 1.6 static const char KEY[];
|
544 kumpf 1.1
|
545 chuck 1.6 //InvalidAuthHeader() : Exception(MSG) { }
546 InvalidAuthHeader()
547 : Exception(MessageLoaderParms(KEY, MSG)) { }
|
548 kumpf 1.1 };
549
550 class PEGASUS_COMMON_LINKAGE UnauthorizedAccess: public Exception
551 {
552 public:
553
554 static const char MSG[];
|
555 chuck 1.6 static const char KEY[];
|
556 kumpf 1.1
|
557 chuck 1.6 //UnauthorizedAccess() : Exception(MSG) { }
558 UnauthorizedAccess()
559 : Exception(MessageLoaderParms(KEY, MSG)) { }
|
560 kumpf 1.1 };
561
|
562 kumpf 1.4 class PEGASUS_COMMON_LINKAGE IncompatibleTypesException : public Exception
563 {
564 public:
|
565 chuck 1.5 IncompatibleTypesException();
|
566 kumpf 1.4 };
567
568
|
569 kumpf 1.1 /** The CIMException defines the CIM exceptions that are formally defined in
|
570 kumpf 1.2 the CIM Operations over HTTP specification. TraceableCIMException allows
|
571 kumpf 1.1 file name and line number information to be added for diagnostic purposes.
572 */
|
573 kumpf 1.2 class PEGASUS_COMMON_LINKAGE TraceableCIMException : public CIMException
|
574 kumpf 1.1 {
575 public:
576
|
577 kumpf 1.2 TraceableCIMException(
578 CIMStatusCode code,
579 const String& message,
580 const char* file,
581 Uint32 line);
582
|
583 chuck 1.5 // l10n
584 TraceableCIMException(
585 const ContentLanguages& langs,
586 CIMStatusCode code,
587 const String& message,
588 const char* file,
589 Uint32 line);
590
|
591 kumpf 1.2 TraceableCIMException(const CIMException & cimException);
592
593 String getDescription() const;
|
594 kumpf 1.1
595 String getTraceDescription() const;
|
596 kumpf 1.2 };
|
597 kumpf 1.1
|
598 kumpf 1.2 #define PEGASUS_CIM_EXCEPTION(CODE, EXTRA_MESSAGE) \
599 TraceableCIMException(CODE, EXTRA_MESSAGE, __FILE__, __LINE__)
|
600 chuck 1.5
601 // l10n
602 #define PEGASUS_CIM_EXCEPTION_LANG(LANGS, CODE, EXTRA_MESSAGE) \
603 TraceableCIMException(LANGS, CODE, EXTRA_MESSAGE, __FILE__, __LINE__)
|
604 kumpf 1.1
605 PEGASUS_NAMESPACE_END
606
607 #endif /* Pegasus_InternalException_h */
|