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 sahana.prabhakar 1.34 BadQualifierType(const String& qualifierName,
141 const String& className = String());
142 virtual ~BadQualifierType();
143 const String _qualifierName;
144 const String _className;
145 const String& getQualifierName() const;
146 const String& getClassName() const;
|
147 kumpf 1.1
148 };
149
150 // ATTN: P3 KS documentation Required
151 class PEGASUS_COMMON_LINKAGE InstantiatedAbstractClass : public Exception
152 {
153 public:
154
155 static const char MSG[];
|
156 kumpf 1.22 static const char KEY[];
|
157 kumpf 1.1
|
158 mike 1.19 InstantiatedAbstractClass(const String& className);
159 virtual ~InstantiatedAbstractClass();
|
160 kumpf 1.1 };
161
162 // ATTN: P3 KS documentation Required
163 class PEGASUS_COMMON_LINKAGE NoSuchProperty : public Exception
164 {
165 public:
166
167 static const char MSG[];
|
168 kumpf 1.22 static const char KEY[];
|
169 kumpf 1.1
|
170 mike 1.19 NoSuchProperty(const String& propertyName);
171 virtual ~NoSuchProperty();
|
172 kumpf 1.1 };
173
174 // ATTN: P3 KS documentation Required
175 class PEGASUS_COMMON_LINKAGE NoSuchFile : public Exception
176 {
177 public:
178
179 static const char MSG[];
|
180 kumpf 1.22 static const char KEY[];
|
181 kumpf 1.1
|
182 mike 1.19 NoSuchFile(const String& fileName);
183 virtual ~NoSuchFile();
|
184 kumpf 1.1 };
185
186 // ATTN: P3 KS documentation Required
187 class PEGASUS_COMMON_LINKAGE FileNotReadable : public Exception
188 {
189 public:
190
191 static const char MSG[];
|
192 kumpf 1.22 static const char KEY[];
|
193 kumpf 1.1
|
194 mike 1.19 FileNotReadable(const String& fileName);
195 virtual ~FileNotReadable();
|
196 kumpf 1.1 };
197
198 // ATTN: P3 KS documentation Required
199 class PEGASUS_COMMON_LINKAGE CannotRemoveDirectory : public Exception
200 {
201 public:
202
203 static const char MSG[];
|
204 kumpf 1.22 static const char KEY[];
|
205 kumpf 1.1
|
206 mike 1.19 CannotRemoveDirectory(const String& path);
207 virtual ~CannotRemoveDirectory();
|
208 kumpf 1.1 };
209
210 // ATTN: P3 KS documentation Required
211 class PEGASUS_COMMON_LINKAGE CannotRemoveFile : public Exception
212 {
213 public:
214
215 static const char MSG[];
|
216 kumpf 1.22 static const char KEY[];
|
217 kumpf 1.1
|
218 mike 1.19 CannotRemoveFile(const String& path);
219 virtual ~CannotRemoveFile();
|
220 kumpf 1.1 };
221
222 // ATTN: P3 KS documentation Required
223 class PEGASUS_COMMON_LINKAGE CannotRenameFile : public Exception
224 {
225 public:
226
227 static const char MSG[];
|
228 kumpf 1.22 static const char KEY[];
|
229 kumpf 1.1
|
230 mike 1.19 CannotRenameFile(const String& path);
231 virtual ~CannotRenameFile();
|
232 kumpf 1.1 };
233
234 // ATTN: P3 KS documentation Required
235 class PEGASUS_COMMON_LINKAGE NoSuchDirectory : public Exception
236 {
237 public:
238
239 static const char MSG[];
|
240 kumpf 1.22 static const char KEY[];
|
241 kumpf 1.1
|
242 mike 1.19 NoSuchDirectory(const String& directoryName);
243 virtual ~NoSuchDirectory();
|
244 kumpf 1.1 };
245
246 // ATTN: P3 KS documentation Required
247 class PEGASUS_COMMON_LINKAGE CannotCreateDirectory : public Exception
248 {
249 public:
250
251 static const char MSG[];
|
252 kumpf 1.22 static const char KEY[];
|
253 kumpf 1.1
|
254 mike 1.19 CannotCreateDirectory(const String& path);
255 virtual ~CannotCreateDirectory();
|
256 kumpf 1.1 };
257
258 // ATTN: P3 KS documentation Required
259 class PEGASUS_COMMON_LINKAGE CannotOpenFile : public Exception
260 {
261 public:
262
263 static const char MSG[];
|
264 kumpf 1.22 static const char KEY[];
|
265 kumpf 1.1
|
266 mike 1.19 CannotOpenFile(const String& path);
267 virtual ~CannotOpenFile();
|
268 kumpf 1.1 };
269
270 // ATTN: P3 KS documentation Required
|
271 thilo.boehm 1.32 class PEGASUS_COMMON_LINKAGE CannotChangeFilePerm : public Exception
272 {
273 public:
274
275 static const char MSG[];
276 static const char KEY[];
277
278 CannotChangeFilePerm(const String& path);
279 virtual ~CannotChangeFilePerm();
280 };
281
282 // ATTN: P3 KS documentation Required
|
283 kumpf 1.1 class PEGASUS_COMMON_LINKAGE NotImplemented : public Exception
284 {
285 public:
286
287 static const char MSG[];
|
288 kumpf 1.22 static const char KEY[];
|
289 kumpf 1.1
|
290 mike 1.19 NotImplemented(const String& method);
291 virtual ~NotImplemented();
|
292 kumpf 1.1 };
293
294 class PEGASUS_COMMON_LINKAGE StackUnderflow : public Exception
295 {
296 public:
297
298 static const char MSG[];
|
299 kumpf 1.22 static const char KEY[];
|
300 kumpf 1.1
|
301 mike 1.19 StackUnderflow();
302 virtual ~StackUnderflow();
|
303 kumpf 1.1 };
304
305 class PEGASUS_COMMON_LINKAGE StackOverflow : public Exception
306 {
307 public:
308
309 static const char MSG[];
|
310 kumpf 1.22 static const char KEY[];
|
311 kumpf 1.1
|
312 mike 1.19 StackOverflow();
313 virtual ~StackOverflow();
|
314 kumpf 1.1 };
315
316 class PEGASUS_COMMON_LINKAGE DynamicLoadFailed : public Exception
317 {
318 public:
319
320 static const char MSG[];
|
321 kumpf 1.22 static const char KEY[];
|
322 kumpf 1.1
|
323 mike 1.19 DynamicLoadFailed(const String& libraryName);
324 virtual ~DynamicLoadFailed();
|
325 kumpf 1.1 };
326
327 class PEGASUS_COMMON_LINKAGE DynamicLookupFailed : public Exception
328 {
329 public:
330
331 static const char MSG[];
|
332 kumpf 1.22 static const char KEY[];
|
333 kumpf 1.1
|
334 mike 1.19 DynamicLookupFailed(const String& symbolName);
335 virtual ~DynamicLookupFailed();
|
336 kumpf 1.1 };
337
338 class PEGASUS_COMMON_LINKAGE CannotOpenDirectory : public Exception
339 {
340 public:
341
342 static const char MSG[];
|
343 kumpf 1.22 static const char KEY[];
|
344 kumpf 1.1
|
345 mike 1.19 CannotOpenDirectory(const String& path);
346 virtual ~CannotOpenDirectory();
|
347 kumpf 1.1 };
348
349 class PEGASUS_COMMON_LINKAGE ParseError : public Exception
350 {
351 public:
352
353 static const char MSG[];
|
354 kumpf 1.22 static const char KEY[];
|
355 kumpf 1.1
|
356 mike 1.19 ParseError(const String& message);
357 virtual ~ParseError();
|
358 kumpf 1.1 };
359
360 class PEGASUS_COMMON_LINKAGE MissingNullTerminator : public Exception
361 {
362 public:
363
364 static const char MSG[];
|
365 kumpf 1.22 static const char KEY[];
|
366 kumpf 1.1
|
367 mike 1.19 MissingNullTerminator();
368 virtual ~MissingNullTerminator();
|
369 chuck 1.5 };
370
371 class PEGASUS_COMMON_LINKAGE MalformedLanguageHeader: public Exception
372 {
373 public:
374
375 static const char MSG[];
|
376 kumpf 1.22 static const char KEY[];
|
377 chuck 1.5
|
378 mike 1.19 MalformedLanguageHeader(const String& error);
379 virtual ~MalformedLanguageHeader();
|
380 chuck 1.5 };
381
382 class PEGASUS_COMMON_LINKAGE InvalidAcceptLanguageHeader: public Exception
383 {
384 public:
385
386 static const char MSG[];
|
387 kumpf 1.22 static const char KEY[];
|
388 chuck 1.5
|
389 mike 1.19 InvalidAcceptLanguageHeader(const String& error);
390 virtual ~InvalidAcceptLanguageHeader();
|
391 kumpf 1.1 };
392
|
393 chuck 1.5 class PEGASUS_COMMON_LINKAGE InvalidContentLanguageHeader: public Exception
394 {
395 public:
396
397 static const char MSG[];
|
398 kumpf 1.22 static const char KEY[];
|
399 chuck 1.5
|
400 mike 1.19 InvalidContentLanguageHeader(const String& error);
401 virtual ~InvalidContentLanguageHeader();
|
402 chuck 1.5 };
403
|
404 kumpf 1.1 class PEGASUS_COMMON_LINKAGE InvalidAuthHeader: public Exception
405 {
406 public:
407
408 static const char MSG[];
|
409 kumpf 1.22 static const char KEY[];
|
410 kumpf 1.1
|
411 mike 1.19 InvalidAuthHeader();
412 virtual ~InvalidAuthHeader();
|
413 kumpf 1.1 };
414
415 class PEGASUS_COMMON_LINKAGE UnauthorizedAccess: public Exception
416 {
417 public:
418
419 static const char MSG[];
|
420 kumpf 1.22 static const char KEY[];
|
421 kumpf 1.1
|
422 mike 1.19 UnauthorizedAccess();
423 virtual ~UnauthorizedAccess();
|
424 kumpf 1.1 };
425
|
426 kumpf 1.4 class PEGASUS_COMMON_LINKAGE IncompatibleTypesException : public Exception
427 {
428 public:
|
429 kumpf 1.22 IncompatibleTypesException();
430 virtual ~IncompatibleTypesException();
|
431 kumpf 1.4 };
432
|
433 kumpf 1.10 class PEGASUS_COMMON_LINKAGE InternalSystemError : public Exception
434 {
435 public:
436
437 static const char MSG[];
438
|
439 mike 1.19 InternalSystemError();
440 virtual ~InternalSystemError();
|
441 kumpf 1.10 };
442
|
443 thilo.boehm 1.33 class PEGASUS_COMMON_LINKAGE SocketWriteError : public Exception
444 {
445 public:
446
447 static const char MSG[];
448 static const char KEY[];
449
450 SocketWriteError(const String& error);
451 virtual ~SocketWriteError();
452 };
|
453 kumpf 1.4
|
454 marek 1.35 class PEGASUS_COMMON_LINKAGE TooManyHTTPHeadersException : public Exception
455 {
456 public:
457 TooManyHTTPHeadersException();
458 virtual ~TooManyHTTPHeadersException();
459 };
460
461 class PEGASUS_COMMON_LINKAGE TooManyElementsException : public Exception
462 {
463 public:
464 static const char MSG[];
465 static const char KEY[];
466
467 TooManyElementsException();
468 virtual ~TooManyElementsException();
469 };
470 // function used to throw TooManyElementsException for use in inlined functions
471 // to reduce static code size
472 PEGASUS_COMMON_LINKAGE extern void ThrowTooManyElementsException();
473
474 // function used to throw IndexOutOfBoundsException for use in inlined functions
475 marek 1.35 // to reduce static code size
476 PEGASUS_COMMON_LINKAGE extern void ThrowIndexOutOfBoundsException();
477
478
|
479 kumpf 1.1 /** The CIMException defines the CIM exceptions that are formally defined in
|
480 kumpf 1.2 the CIM Operations over HTTP specification. TraceableCIMException allows
|
481 kumpf 1.1 file name and line number information to be added for diagnostic purposes.
482 */
|
483 kumpf 1.2 class PEGASUS_COMMON_LINKAGE TraceableCIMException : public CIMException
|
484 kumpf 1.1 {
485 public:
486
|
487 kumpf 1.2 TraceableCIMException(
|
488 kumpf 1.21 CIMStatusCode code,
489 const String& message,
490 const String& file,
491 Uint32 line);
492
493 TraceableCIMException(
494 CIMStatusCode code,
|
495 kumpf 1.23 const MessageLoaderParms& parms,
|
496 kumpf 1.21 const String& file,
497 Uint32 line);
498
499 TraceableCIMException(
500 const ContentLanguageList& langs,
501 CIMStatusCode code,
502 const String& message,
503 const String& file,
504 Uint32 line);
|
505 chuck 1.5
|
506 kumpf 1.2 TraceableCIMException(const CIMException & cimException);
507
508 String getDescription() const;
|
509 kumpf 1.1
510 String getTraceDescription() const;
|
511 kumpf 1.11
512 String getCIMMessage() const;
513 void setCIMMessage(const String& cimMessage);
514
515 String getFile() const;
516 Uint32 getLine() const;
|
517 kumpf 1.16 const ContentLanguageList& getContentLanguages() const;
|
518 kumpf 1.2 };
|
519 kumpf 1.1
|
520 kumpf 1.2 #define PEGASUS_CIM_EXCEPTION(CODE, EXTRA_MESSAGE) \
|
521 kumpf 1.11 TraceableCIMException(CODE, EXTRA_MESSAGE, String(__FILE__), __LINE__)
|
522 chuck 1.5
523 #define PEGASUS_CIM_EXCEPTION_LANG(LANGS, CODE, EXTRA_MESSAGE) \
|
524 kumpf 1.11 TraceableCIMException( \
|
525 kumpf 1.22 LANGS, CODE, EXTRA_MESSAGE, String(__FILE__), __LINE__)
526
|
527 humberto 1.7 #define PEGASUS_CIM_EXCEPTION_L(CODE, MSG_PARMS) \
|
528 kumpf 1.11 TraceableCIMException(CODE, MSG_PARMS, String(__FILE__), __LINE__)
|
529 kumpf 1.1
|
530 kumpf 1.22 /** Macro to prevent overflow of a signed int value when said value is
|
531 dave.sudlik 1.18 * doubled. If String/Array/Buffer size is greater than 0x3FFFFFFF, then
532 * something is suspect, throw bad_alloc exception.
533 */
534 #define PEGASUS_CHECK_CAPACITY_OVERFLOW(capacity) \
535 do \
536 { \
537 if (capacity > 0x3FFFFFFF) \
538 throw PEGASUS_STD(bad_alloc)(); \
539 } \
540 while (0)
541
|
542 marek 1.25 /** The following function CheckRep serves to reduce the function call
543 * overhead caused by calling a non-inlined function that only checks
544 * if a pointer is not NULL.
|
545 kumpf 1.31 * The function ThrowUnitializedObjectException throws
|
546 marek 1.25 * an UninitialisedObjectException.
547 * A function to throw the exception is used to reduce object size of
548 * function CheckRep which is inlined in many places across
549 * the common library.
550 */
551 PEGASUS_COMMON_LINKAGE extern void ThrowUninitializedObjectException();
552
|
553 marek 1.36 PEGASUS_COMMON_LINKAGE extern void ThrowCannotOpenFileException(
554 const char* path);
555
|
556 marek 1.25 inline void CheckRep(void * rep)
557 {
|
558 kumpf 1.31 if (!rep)
|
559 marek 1.25 ThrowUninitializedObjectException();
|
560 dmitry.mikulin 1.28 }
|
561 marek 1.25
|
562 kumpf 1.1 PEGASUS_NAMESPACE_END
563
564 #endif /* Pegasus_InternalException_h */
|