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

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2