(file) Return to Exception.cpp CVS log (file) (dir) Up to [Pegasus] / pegasus / src / Pegasus / Common

  1 mike  1.22 //%/////////////////////////////////////////////////////////////////////////////
  2            //
  3            // Copyright (c) 2000, 2001 The Open group, BMC Software, Tivoli Systems, IBM
  4            //
  5            // Permission is hereby granted, free of charge, to any person obtaining a copy
  6            // of this software and associated documentation files (the "Software"), to 
  7            // deal in the Software without restriction, including without limitation the 
  8            // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 
  9            // sell copies of the Software, and to permit persons to whom the Software is
 10            // furnished to do so, subject to the following conditions:
 11            // 
 12            // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN 
 13            // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
 14            // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
 15            // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR 
 16            // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 
 17            // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 
 18            // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 19            // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 20            //
 21            //==============================================================================
 22 mike  1.22 //
 23            // Author: Mike Brasher (mbrasher@bmc.com)
 24            //
 25 mike  1.23 // Modified By: Nag Boranna (nagaraja_boranna@hp.com)
 26            //
 27 mike  1.22 // Modified By:
 28            //
 29            //%/////////////////////////////////////////////////////////////////////////////
 30            
 31            #include <cstdio>
 32            #include "Exception.h"
 33            
 34            PEGASUS_NAMESPACE_BEGIN
 35            
 36            Exception::Exception(const String& message) : _message(message) 
 37            { 
 38            
 39            }
 40            
 41            Exception::Exception(const char* message) : _message(message) 
 42            {
 43            
 44            }
 45            
 46            Exception::~Exception()
 47            {
 48 mike  1.22 
 49            }
 50            
 51            AssertionFailureException::AssertionFailureException(
 52                const char* file, 
 53                size_t line,
 54                const String& message) : Exception(String())
 55            {
 56                char lineStr[32];
 57                sprintf(lineStr, "%d", line);
 58            
 59                _message = file;
 60                _message.append("(");
 61                _message.append(lineStr);
 62                _message.append("): ");
 63                _message.append(message);
 64            }
 65            
 66            const char OutOfBounds::MSG[] = "out of bounds";
 67            
 68            const char AlreadyExists::MSG[] = "already exists: ";
 69 mike  1.22 
 70            const char NullPointer::MSG[] = "null pointer";
 71            
 72            const char UnitializedHandle::MSG[] = "unitialized handle";
 73            
 74            const char IllegalName::MSG[] = "illegal CIM name";
 75            
 76            const char InvalidPropertyOverride::MSG[] = "invalid property override: ";
 77            
 78            const char InvalidMethodOverride::MSG[] = "invalid method override: ";
 79            
 80            const char UndeclaredQualifier::MSG[] = "undeclared qualifier: ";
 81            
 82            const char BadQualifierScope::MSG[] = "qualifier invalid in this scope: ";
 83            
 84            const char BadQualifierOverride::MSG[] = "qualifier not overridable: ";
 85            
 86            const char BadQualifierType::MSG[] = 
 87                "CIMType of qualifier different than its declaration: ";
 88            
 89            const char NullType::MSG[] = "type is null";
 90 mike  1.22 
 91            const char AddedReferenceToClass::MSG[] = 
 92                "attempted to add reference to a non-association class: ";
 93            
 94            const char ClassAlreadyResolved::MSG[] = 
 95                "attempt to resolve a class that is already resolved: ";
 96            
 97            const char ClassNotResolved::MSG[] = 
 98                "class is not yet resolved: ";
 99            
100            const char InstanceAlreadyResolved::MSG[] = 
101                "attempted to resolve a instance that is already resolved";
102            
103            const char InstantiatedAbstractClass::MSG[] = 
104                "attempted to instantiated an abstract class";
105            
106            const char NoSuchProperty::MSG[] = "no such property: ";
107            
108            const char TruncatedCharacter::MSG[] = 
109                "truncated character during conversion from Char16 to char";
110            
111 mike  1.22 const char ExpectedReferenceValue::MSG[] = 
112                "Expected CIMValue object to be CIMType::REFERENCE or CIMType::REFERENCE_ARRAY "
113                "in this context";
114            
115            const char MissingReferenceClassName::MSG[] = "missing reference class name";
116            
117            const char IllegalTypeTag::MSG[] = "illegal type tag";
118            
119            const char TypeMismatch::MSG[] = "type mismatch";
120            
121 karl  1.25 const char CIMValueIsNull::MSG[] = "null CIMValue accessed";
122            
123            const char CIMValueInvalidType::MSG[] = "invalid CIMValue type";
124            
125 mike  1.24 const char DynamicCastFailed::MSG[] = "dynamic cast failed";
126            
127 mike  1.22 const char NoSuchFile::MSG[] = "no such file: ";
128            
129 mike  1.23 const char FileNotReadable::MSG[] = "file not readable: ";
130            
131 mike  1.22 const char CannotBindToAddress::MSG[] = "cannot bind to address: ";
132            
133            const char NoSuchDirectory::MSG[] = "no such directory: ";
134            
135            const char ChangeDirectoryFailed::MSG[] = "cannot change directory: ";
136            
137            const char CannotCreateDirectory::MSG[] = "cannot create directory: ";
138            
139            const char NoSuchNameSpace::MSG[] = "no such namespace: ";
140            
141            const char CannotOpenFile::MSG[] = "cannot open file: ";
142            
143            const char NotImplemented::MSG[] = "not implemented: ";
144            
145            const char CannotRemoveDirectory::MSG[] = "cannot remove directory: ";
146            
147            const char CannotRemoveFile::MSG[] = "cannot remove file: ";
148            
149            const char CannotRenameFile::MSG[] = "cannot rename file: ";
150            
151 mike  1.23 const char StackUnderflow::MSG[] = "stack underflow";
152            
153            const char StackOverflow::MSG[] = "stack overflow";
154 mike  1.22 
155            const char QueueUnderflow::MSG[] = "queue Underflow";
156            
157            const char BadFormat::MSG[] = "bad format passed to Formatter::format()";
158            
159            const char BadDateTimeFormat::MSG[] = "bad datetime format";
160            
161            const char IncompatibleTypes::MSG[] = "incompatible types";
162            
163            const char BadlyFormedCGIQueryString::MSG[] = "badly formed CGI query string";
164            
165            const char IllformedObjectName::MSG[] = "illformed object name: ";
166            
167            const char DynamicLoadFailed::MSG[] = "load of dynamic library failed: ";
168            
169            const char DynamicLookupFailed::MSG[] = 
170                "lookup of symbol in dynamic library failed: ";
171            
172            const char CannotOpenDirectory::MSG[] = "cannot open directory: ";
173            
174            const char CorruptFile::MSG[] = "corrupt file: ";
175 mike  1.23 
176            const char BindFailed::MSG[] = "Bind failed: ";
177            
178            const char InvalidLocator::MSG[] = "Invalid locator: ";
179            
180            const char CannotCreateSocket::MSG[] = "Cannot create socket";
181            
182            const char CannotConnect::MSG[] = "Cannot connect to: ";
183            
184            const char UnexpectedFailure::MSG[] = "Unexpected failure";
185            
186            const char FailedToConnect::MSG[] = "failed to connect";
187            
188            const char AlreadyConnected::MSG[] = "already connected";
189            
190            const char NotConnected::MSG[] = "not connected";
191            
192            const char TimedOut::MSG[] = "timed out";
193            
194            const char ParseError::MSG[] = "parse error: ";
195            
196 mike  1.23 const char MissingNullTerminator::MSG[] = "missing null terminator: ";
197            
198            const char SSL_Exception::MSG[] = "SSL Exception ";
199 mike  1.22 
200 kumpf 1.26 const char InvalidAuthHeader::MSG[] = "Invalid Authorization header";
201            
202            
203 mike  1.22 ////////////////////////////////////////////////////////////////////////////////
204            //
205            // CIMException
206            //
207            ////////////////////////////////////////////////////////////////////////////////
208            
209            static String _makeCIMExceptionMessage(
210                CIMStatusCode code, 
211                const char* file,
212                Uint32 line,
213                const String& extraMessage)
214            {
215                String tmp = file;
216                tmp.append("(");
217                char buffer[32];
218                sprintf(buffer, "%d", line);
219                tmp.append(buffer);
220                tmp.append("): ");
221            
222                tmp.append(CIMStatusCodeToString(code));
223                tmp.append(": \"");
224 mike  1.22     tmp.append(extraMessage);
225                tmp.append("\"");
226                return tmp;
227            }
228            
229            CIMException::CIMException(
230                CIMStatusCode code, 
231                const char* file,
232                Uint32 line,
233                const String& extraMessage)
234                : Exception(_makeCIMExceptionMessage(code, file, line, extraMessage)),
235                _code(code)
236            {
237            
238            }
239            
240            void ThrowUnitializedHandle()
241            {
242                throw UnitializedHandle();
243            }
244            
245 mike  1.22 PEGASUS_NAMESPACE_END

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2