(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.9 // Revision 1.8  2001/03/05 04:29:01  mike
 27           // renamed CimException to CIMException
 28           //
 29 mike  1.8 // Revision 1.7  2001/02/16 02:06:06  mike
 30           // Renamed many classes and headers.
 31           //
 32 mike  1.7 // Revision 1.6  2001/02/11 05:42:33  mike
 33           // new
 34           //
 35 mike  1.6 // Revision 1.5  2001/01/29 02:23:44  mike
 36           // Added support for GetInstance operation
 37           //
 38 mike  1.5 // Revision 1.4  2001/01/28 04:11:03  mike
 39           // fixed qualifier resolution
 40           //
 41 mike  1.4 // Revision 1.3  2001/01/23 01:25:35  mike
 42           // Reworked resolve scheme.
 43           //
 44 mike  1.3 // Revision 1.2  2001/01/22 00:45:47  mike
 45           // more work on resolve scheme
 46           //
 47 mike  1.2 // Revision 1.1.1.1  2001/01/14 19:51:33  mike
 48           // Pegasus import
 49           //
 50 mike  1.1 //
 51           //END_HISTORY
 52           
 53           #include <cstdio>
 54           #include "Exception.h"
 55           
 56           PEGASUS_NAMESPACE_BEGIN
 57           
 58           Exception::Exception(const String& message) : _message(message) 
 59           { 
 60           
 61           }
 62           
 63           Exception::Exception(const char* message) : _message(message) 
 64           {
 65           
 66           }
 67           
 68           Exception::~Exception()
 69           {
 70           
 71 mike  1.1 }
 72           
 73           AssertionFailureException::AssertionFailureException(
 74               const char* file, 
 75               size_t line,
 76               const String& message) : Exception(String())
 77           {
 78               char lineStr[32];
 79               sprintf(lineStr, "%d", line);
 80           
 81               _message = file;
 82               _message.append("(");
 83               _message.append(lineStr);
 84               _message.append("): ");
 85               _message.append(message);
 86           }
 87           
 88           const char OutOfBounds::MSG[] = "out of bounds";
 89           
 90           const char AlreadyExists::MSG[] = "already exists: ";
 91           
 92 mike  1.1 const char NullPointer::MSG[] = "null pointer";
 93           
 94           const char UnitializedHandle::MSG[] = "unitialized reference";
 95           
 96           const char IllegalName::MSG[] = "illegal CIM name";
 97           
 98           const char NoSuchSuperClass::MSG[] = "no such super class: ";
 99 mike  1.2 
100           const char NoSuchClass::MSG[] = "no such class: ";
101 mike  1.1 
102           const char InvalidPropertyOverride::MSG[] = "invalid property override: ";
103           
104           const char InvalidMethodOverride::MSG[] = "invalid method override: ";
105           
106           const char UndeclaredQualifier::MSG[] = "undeclared qualifier: ";
107           
108           const char BadQualifierScope::MSG[] = "qualifier invalid in this scope: ";
109           
110           const char BadQualifierOverride::MSG[] = "qualifier not overridable: ";
111           
112 mike  1.4 const char BadQualifierType::MSG[] = 
113 mike  1.7     "CIMType of qualifier different than its declaration: ";
114 mike  1.4 
115 mike  1.1 const char NullType::MSG[] = "type is null";
116           
117           const char AddedReferenceToClass::MSG[] = 
118               "attempted to add reference to a non-association class: ";
119           
120           const char ClassAlreadyResolved::MSG[] = 
121               "attempt to resolve a class that is already resolved: ";
122           
123           const char ClassNotResolved::MSG[] = 
124               "class is not yet resolved: ";
125           
126           const char InstanceAlreadyResolved::MSG[] = 
127               "attempted to resolve a instance that is already resolved";
128           
129           const char InstantiatedAbstractClass::MSG[] = 
130               "attempted to instantiated an abstract class";
131           
132           const char NoSuchProperty::MSG[] = "no such property: ";
133           
134           const char TruncatedCharacter::MSG[] = 
135               "truncated character during conversion from Char16 to char";
136 mike  1.1 
137           const char ExpectedReferenceValue::MSG[] = 
138 mike  1.7     "Expected CIMValue object to be CIMType::REFERENCE or CIMType::REFERENCE_ARRAY "
139 mike  1.1     "in this context";
140           
141           const char MissingReferenceClassName::MSG[] = "missing reference class name";
142           
143           const char IllegalTypeTag::MSG[] = "illegal type tag";
144           
145           const char TypeMismatch::MSG[] = "type mismatch";
146           
147           const char NoSuchFile::MSG[] = "no such file: ";
148           
149           const char NoSuchDirectory::MSG[] = "no such directory: ";
150           
151           const char ChangeDirectoryFailed::MSG[] = "failed to change directory: ";
152           
153           const char CannotCreateDirectory::MSG[] = "cannot create directory: ";
154           
155           const char NoSuchNameSpace::MSG[] = "no such namespace: ";
156           
157           const char CannotOpenFile::MSG[] = "cannot open file: ";
158           
159           const char NotImplemented::MSG[] = "not implemented: ";
160 mike  1.1 
161           const char FailedToRemoveDirectory::MSG[] = "failed to remove directory: ";
162           
163           const char FailedToRemoveFile::MSG[] = "failed to remove file: ";
164           
165           const char StackUnderflow::MSG[] = "stack overflow";
166           
167           const char BadFormat::MSG[] = "bad format passed to Formatter::format()";
168           
169           const char BadDateTimeFormat::MSG[] = "bad datetime format";
170           
171           const char IncompatibleTypes::MSG[] = "incompatible types";
172           
173           const char BadlyFormedCGIQueryString::MSG[] = "badly formed CGI query string";
174 mike  1.4 
175 mike  1.9 const char IllformedObjectPath::MSG[] = "illformed object path: ";
176 mike  1.5 
177           const char DynamicLoadFailed::MSG[] = "load of dynamic library failed: ";
178           
179           const char DynamicLookupFailed::MSG[] = 
180               "lookup of symbol in dynamic library failed: ";
181 mike  1.6 
182           const char CannotOpenDirectory::MSG[] = "cannot open directory: ";
183 mike  1.1 
184           ////////////////////////////////////////////////////////////////////////////////
185           //
186 mike  1.8 // CIMException
187 mike  1.1 //
188           ////////////////////////////////////////////////////////////////////////////////
189           
190           static char* _cimMessages[] =
191           {
192               "successful",
193           
194               "A general error occurred that is not covered by a more specific "
195               "error code.",
196           
197               "Access to a CIM resource was not available to the client.",
198           
199               "The target namespace does not exist.",
200           
201               "One or more parameter values passed to the method were invalid.",
202           
203               "The specified class does not exist.",
204           
205               "The requested object could not be found.",
206           
207               "The requested operation is not supported.",
208 mike  1.1 
209               "Operation cannot be carried out on this class since it has subclasses.",
210           
211               "Operation cannot be carried out on this class since it has instances.",
212           
213               "Operation cannot be carried out since the specified "
214               "superClass does not exist.",
215           
216               "Operation cannot be carried out because an object already exists.",
217           
218               "The specified property does not exist.",
219           
220               "The value supplied is incompatible with the type.",
221           
222               "The query language is not recognized or supported.",
223           
224               "The query is not valid for the specified query language.",
225           
226               "The extrinsic method could not be executed.",
227           
228               "The specified extrinsic method does not exist."
229 mike  1.1 };
230           
231 mike  1.8 static String _makeCIMExceptionMessage(
232               CIMException::Code code, 
233               const String& extraMessage) 
234           {
235               String tmp = _cimMessages[Uint32(code)];
236               tmp.append(": ");
237               tmp.append(extraMessage);
238               return tmp;
239           }
240           
241           CIMException::CIMException(
242               CIMException::Code code, 
243               const String& extraMessage) 
244               : Exception(_makeCIMExceptionMessage(code, extraMessage)), _code(code)
245 mike  1.1 {
246           
247           }
248           
249 mike  1.8 const char* CIMException::codeToString(CIMException::Code code)
250 mike  1.1 {
251               return _cimMessages[Uint32(code)];
252           }
253           
254           PEGASUS_NAMESPACE_END

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2