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

  1 mike  1.1 //BEGIN_LICENSE
  2           //
  3           // Copyright (c) 2000 The Open Group, BMC Software, Tivoli Systems, IBM
  4           //
  5           // Permission is hereby granted, free of charge, to any person obtaining a
  6           // copy of this software and associated documentation files (the "Software"),
  7           // to deal in the Software without restriction, including without limitation
  8           // the rights to use, copy, modify, merge, publish, distribute, sublicense,
  9           // and/or sell copies of the Software, and to permit persons to whom the
 10           // Software is furnished to do so, subject to the following conditions:
 11           //
 12           // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 13           // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 14           // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
 15           // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 16           // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 17           // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
 18           // DEALINGS IN THE SOFTWARE.
 19           //
 20           //END_LICENSE
 21           //BEGIN_HISTORY
 22 mike  1.1 //
 23           // Author:
 24           //
 25 mike  1.2 // $Log: Exception.cpp,v $
 26 mike  1.8 // Revision 1.7  2001/02/16 02:06:06  mike
 27           // Renamed many classes and headers.
 28           //
 29 mike  1.7 // Revision 1.6  2001/02/11 05:42:33  mike
 30           // new
 31           //
 32 mike  1.6 // Revision 1.5  2001/01/29 02:23:44  mike
 33           // Added support for GetInstance operation
 34           //
 35 mike  1.5 // Revision 1.4  2001/01/28 04:11:03  mike
 36           // fixed qualifier resolution
 37           //
 38 mike  1.4 // Revision 1.3  2001/01/23 01:25:35  mike
 39           // Reworked resolve scheme.
 40           //
 41 mike  1.3 // Revision 1.2  2001/01/22 00:45:47  mike
 42           // more work on resolve scheme
 43           //
 44 mike  1.2 // Revision 1.1.1.1  2001/01/14 19:51:33  mike
 45           // Pegasus import
 46           //
 47 mike  1.1 //
 48           //END_HISTORY
 49           
 50           #include <cstdio>
 51           #include "Exception.h"
 52           
 53           PEGASUS_NAMESPACE_BEGIN
 54           
 55           Exception::Exception(const String& message) : _message(message) 
 56           { 
 57           
 58           }
 59           
 60           Exception::Exception(const char* message) : _message(message) 
 61           {
 62           
 63           }
 64           
 65           Exception::~Exception()
 66           {
 67           
 68 mike  1.1 }
 69           
 70           AssertionFailureException::AssertionFailureException(
 71               const char* file, 
 72               size_t line,
 73               const String& message) : Exception(String())
 74           {
 75               char lineStr[32];
 76               sprintf(lineStr, "%d", line);
 77           
 78               _message = file;
 79               _message.append("(");
 80               _message.append(lineStr);
 81               _message.append("): ");
 82               _message.append(message);
 83           }
 84           
 85           const char OutOfBounds::MSG[] = "out of bounds";
 86           
 87           const char AlreadyExists::MSG[] = "already exists: ";
 88           
 89 mike  1.1 const char NullPointer::MSG[] = "null pointer";
 90           
 91           const char UnitializedHandle::MSG[] = "unitialized reference";
 92           
 93           const char IllegalName::MSG[] = "illegal CIM name";
 94           
 95           const char NoSuchSuperClass::MSG[] = "no such super class: ";
 96 mike  1.2 
 97           const char NoSuchClass::MSG[] = "no such class: ";
 98 mike  1.1 
 99           const char InvalidPropertyOverride::MSG[] = "invalid property override: ";
100           
101           const char InvalidMethodOverride::MSG[] = "invalid method override: ";
102           
103           const char UndeclaredQualifier::MSG[] = "undeclared qualifier: ";
104           
105           const char BadQualifierScope::MSG[] = "qualifier invalid in this scope: ";
106           
107           const char BadQualifierOverride::MSG[] = "qualifier not overridable: ";
108           
109 mike  1.4 const char BadQualifierType::MSG[] = 
110 mike  1.7     "CIMType of qualifier different than its declaration: ";
111 mike  1.4 
112 mike  1.1 const char NullType::MSG[] = "type is null";
113           
114           const char AddedReferenceToClass::MSG[] = 
115               "attempted to add reference to a non-association class: ";
116           
117           const char ClassAlreadyResolved::MSG[] = 
118               "attempt to resolve a class that is already resolved: ";
119           
120           const char ClassNotResolved::MSG[] = 
121               "class is not yet resolved: ";
122           
123           const char InstanceAlreadyResolved::MSG[] = 
124               "attempted to resolve a instance that is already resolved";
125           
126           const char InstantiatedAbstractClass::MSG[] = 
127               "attempted to instantiated an abstract class";
128           
129           const char NoSuchProperty::MSG[] = "no such property: ";
130           
131           const char TruncatedCharacter::MSG[] = 
132               "truncated character during conversion from Char16 to char";
133 mike  1.1 
134           const char ExpectedReferenceValue::MSG[] = 
135 mike  1.7     "Expected CIMValue object to be CIMType::REFERENCE or CIMType::REFERENCE_ARRAY "
136 mike  1.1     "in this context";
137           
138           const char MissingReferenceClassName::MSG[] = "missing reference class name";
139           
140           const char IllegalTypeTag::MSG[] = "illegal type tag";
141           
142           const char TypeMismatch::MSG[] = "type mismatch";
143           
144           const char NoSuchFile::MSG[] = "no such file: ";
145           
146           const char NoSuchDirectory::MSG[] = "no such directory: ";
147           
148           const char ChangeDirectoryFailed::MSG[] = "failed to change directory: ";
149           
150           const char CannotCreateDirectory::MSG[] = "cannot create directory: ";
151           
152           const char NoSuchNameSpace::MSG[] = "no such namespace: ";
153           
154           const char CannotOpenFile::MSG[] = "cannot open file: ";
155           
156           const char NotImplemented::MSG[] = "not implemented: ";
157 mike  1.1 
158           const char FailedToRemoveDirectory::MSG[] = "failed to remove directory: ";
159           
160           const char FailedToRemoveFile::MSG[] = "failed to remove file: ";
161           
162           const char StackUnderflow::MSG[] = "stack overflow";
163           
164           const char BadFormat::MSG[] = "bad format passed to Formatter::format()";
165           
166           const char BadDateTimeFormat::MSG[] = "bad datetime format";
167           
168           const char IncompatibleTypes::MSG[] = "incompatible types";
169           
170           const char BadlyFormedCGIQueryString::MSG[] = "badly formed CGI query string";
171 mike  1.4 
172           const char BadInstanceName::MSG[] = "bad instance name: ";
173 mike  1.5 
174           const char DynamicLoadFailed::MSG[] = "load of dynamic library failed: ";
175           
176           const char DynamicLookupFailed::MSG[] = 
177               "lookup of symbol in dynamic library failed: ";
178 mike  1.6 
179           const char CannotOpenDirectory::MSG[] = "cannot open directory: ";
180 mike  1.1 
181           ////////////////////////////////////////////////////////////////////////////////
182           //
183 mike  1.8 // CIMException
184 mike  1.1 //
185           ////////////////////////////////////////////////////////////////////////////////
186           
187           static char* _cimMessages[] =
188           {
189               "successful",
190           
191               "A general error occurred that is not covered by a more specific "
192               "error code.",
193           
194               "Access to a CIM resource was not available to the client.",
195           
196               "The target namespace does not exist.",
197           
198               "One or more parameter values passed to the method were invalid.",
199           
200               "The specified class does not exist.",
201           
202               "The requested object could not be found.",
203           
204               "The requested operation is not supported.",
205 mike  1.1 
206               "Operation cannot be carried out on this class since it has subclasses.",
207           
208               "Operation cannot be carried out on this class since it has instances.",
209           
210               "Operation cannot be carried out since the specified "
211               "superClass does not exist.",
212           
213               "Operation cannot be carried out because an object already exists.",
214           
215               "The specified property does not exist.",
216           
217               "The value supplied is incompatible with the type.",
218           
219               "The query language is not recognized or supported.",
220           
221               "The query is not valid for the specified query language.",
222           
223               "The extrinsic method could not be executed.",
224           
225               "The specified extrinsic method does not exist."
226 mike  1.1 };
227           
228 mike  1.8 static String _makeCIMExceptionMessage(
229               CIMException::Code code, 
230               const String& extraMessage) 
231           {
232               String tmp = _cimMessages[Uint32(code)];
233               tmp.append(": ");
234               tmp.append(extraMessage);
235               return tmp;
236           }
237           
238           CIMException::CIMException(
239               CIMException::Code code, 
240               const String& extraMessage) 
241               : Exception(_makeCIMExceptionMessage(code, extraMessage)), _code(code)
242 mike  1.1 {
243           
244           }
245           
246 mike  1.8 const char* CIMException::codeToString(CIMException::Code code)
247 mike  1.1 {
248               return _cimMessages[Uint32(code)];
249           }
250           
251           PEGASUS_NAMESPACE_END

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2