(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 kumpf 1.22.2.2 // 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                const char NoSuchFile::MSG[] = "no such file: ";
122 kumpf 1.22.2.2 
123                const char FileNotReadable::MSG[] = "file not readable: ";
124 mike  1.22     
125                const char CannotBindToAddress::MSG[] = "cannot bind to address: ";
126                
127                const char NoSuchDirectory::MSG[] = "no such directory: ";
128                
129                const char ChangeDirectoryFailed::MSG[] = "cannot change directory: ";
130                
131                const char CannotCreateDirectory::MSG[] = "cannot create directory: ";
132                
133                const char NoSuchNameSpace::MSG[] = "no such namespace: ";
134                
135                const char CannotOpenFile::MSG[] = "cannot open file: ";
136                
137                const char NotImplemented::MSG[] = "not implemented: ";
138                
139                const char CannotRemoveDirectory::MSG[] = "cannot remove directory: ";
140                
141                const char CannotRemoveFile::MSG[] = "cannot remove file: ";
142                
143                const char CannotRenameFile::MSG[] = "cannot rename file: ";
144                
145 mike  1.22.2.4 const char StackUnderflow::MSG[] = "stack underflow";
146                
147                const char StackOverflow::MSG[] = "stack overflow";
148 mike  1.22     
149                const char QueueUnderflow::MSG[] = "queue Underflow";
150                
151                const char BadFormat::MSG[] = "bad format passed to Formatter::format()";
152                
153                const char BadDateTimeFormat::MSG[] = "bad datetime format";
154                
155                const char IncompatibleTypes::MSG[] = "incompatible types";
156                
157                const char BadlyFormedCGIQueryString::MSG[] = "badly formed CGI query string";
158                
159                const char IllformedObjectName::MSG[] = "illformed object name: ";
160                
161                const char DynamicLoadFailed::MSG[] = "load of dynamic library failed: ";
162                
163                const char DynamicLookupFailed::MSG[] = 
164                    "lookup of symbol in dynamic library failed: ";
165                
166                const char CannotOpenDirectory::MSG[] = "cannot open directory: ";
167                
168                const char CorruptFile::MSG[] = "corrupt file: ";
169 mike  1.22     
170 mike  1.22.2.1 const char BindFailed::MSG[] = "Bind failed: ";
171                
172 mike  1.22.2.3 const char InvalidLocator::MSG[] = "Invalid locator: ";
173                
174                const char CannotCreateSocket::MSG[] = "Cannot create socket";
175                
176                const char CannotConnect::MSG[] = "Cannot connect to: ";
177                
178                const char UnexpectedFailure::MSG[] = "Unexpected failure";
179                
180 mike  1.22.2.5 const char FailedToConnect::MSG[] = "failed to connect";
181                
182                const char AlreadyConnected::MSG[] = "already connected";
183                
184                const char NotConnected::MSG[] = "not connected";
185                
186                const char TimedOut::MSG[] = "timed out";
187                
188 sage  1.22.2.7 //const char ParseError::MSG[] = "parse error: ";
189 mike  1.22.2.6 
190                const char MissingNullTerminator::MSG[] = "missing null terminator: ";
191                
192 mike  1.22     ////////////////////////////////////////////////////////////////////////////////
193                //
194                // CIMException
195                //
196                ////////////////////////////////////////////////////////////////////////////////
197                
198                static String _makeCIMExceptionMessage(
199                    CIMStatusCode code, 
200                    const char* file,
201                    Uint32 line,
202                    const String& extraMessage)
203                {
204                    String tmp = file;
205                    tmp.append("(");
206                    char buffer[32];
207                    sprintf(buffer, "%d", line);
208                    tmp.append(buffer);
209                    tmp.append("): ");
210                
211                    tmp.append(CIMStatusCodeToString(code));
212                    tmp.append(": \"");
213 mike  1.22         tmp.append(extraMessage);
214                    tmp.append("\"");
215                    return tmp;
216                }
217                
218                CIMException::CIMException(
219                    CIMStatusCode code, 
220                    const char* file,
221                    Uint32 line,
222                    const String& extraMessage)
223                    : Exception(_makeCIMExceptionMessage(code, file, line, extraMessage)),
224                    _code(code)
225                {
226                
227                }
228                
229                void ThrowUnitializedHandle()
230                {
231                    throw UnitializedHandle();
232                }
233                
234 mike  1.22     PEGASUS_NAMESPACE_END

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2