version 1.23, 2001/12/13 14:53:56
|
version 1.33, 2002/04/09 03:00:19
|
|
|
// | // |
// Modified By: Nag Boranna (nagaraja_boranna@hp.com) | // Modified By: Nag Boranna (nagaraja_boranna@hp.com) |
// | // |
// Modified By: |
// Modified By: Jenny Yu (jenny_yu@am.exch.hp.com) |
// | // |
//%///////////////////////////////////////////////////////////////////////////// | //%///////////////////////////////////////////////////////////////////////////// |
| |
#include <cstdio> | #include <cstdio> |
#include "Exception.h" | #include "Exception.h" |
|
#include "Tracer.h" |
| |
PEGASUS_NAMESPACE_BEGIN | PEGASUS_NAMESPACE_BEGIN |
| |
|
|
const String& message) : Exception(String()) | const String& message) : Exception(String()) |
{ | { |
char lineStr[32]; | char lineStr[32]; |
sprintf(lineStr, "%d", line); |
sprintf(lineStr, "%u", line); |
| |
_message = file; | _message = file; |
_message.append("("); | _message.append("("); |
_message.append(lineStr); | _message.append(lineStr); |
_message.append("): "); | _message.append("): "); |
_message.append(message); | _message.append(message); |
|
|
|
// ATTN-RK-P3-20020408: Should define a "test" trace component |
|
PEG_TRACE_STRING(TRC_SERVER, Tracer::LEVEL2, _message); |
} | } |
| |
const char OutOfBounds::MSG[] = "out of bounds"; | const char OutOfBounds::MSG[] = "out of bounds"; |
|
|
"attempted to resolve a instance that is already resolved"; | "attempted to resolve a instance that is already resolved"; |
| |
const char InstantiatedAbstractClass::MSG[] = | const char InstantiatedAbstractClass::MSG[] = |
"attempted to instantiated an abstract class"; |
"attempted to instantiate an abstract class "; |
| |
const char NoSuchProperty::MSG[] = "no such property: "; | const char NoSuchProperty::MSG[] = "no such property: "; |
| |
|
|
| |
const char TypeMismatch::MSG[] = "type mismatch"; | const char TypeMismatch::MSG[] = "type mismatch"; |
| |
|
const char CIMValueIsNull::MSG[] = "null CIMValue accessed"; |
|
|
|
const char CIMValueInvalidType::MSG[] = "invalid CIMValue type"; |
|
|
|
const char DynamicCastFailed::MSG[] = "dynamic cast failed"; |
|
|
const char NoSuchFile::MSG[] = "no such file: "; | const char NoSuchFile::MSG[] = "no such file: "; |
| |
const char FileNotReadable::MSG[] = "file not readable: "; | const char FileNotReadable::MSG[] = "file not readable: "; |
|
|
| |
const char SSL_Exception::MSG[] = "SSL Exception "; | const char SSL_Exception::MSG[] = "SSL Exception "; |
| |
|
const char InvalidAuthHeader::MSG[] = "Invalid Authorization header"; |
|
|
|
|
//////////////////////////////////////////////////////////////////////////////// | //////////////////////////////////////////////////////////////////////////////// |
// | // |
// CIMException | // CIMException |
// | // |
//////////////////////////////////////////////////////////////////////////////// | //////////////////////////////////////////////////////////////////////////////// |
| |
|
// |
|
// Creates a message without source file name and line number. |
|
// |
|
static String _makeCIMExceptionMessage( |
|
CIMStatusCode code, |
|
const String& description) |
|
{ |
|
String tmp; |
|
tmp.append(CIMStatusCodeToString(code)); |
|
tmp.append(": \""); |
|
tmp.append(description); |
|
tmp.append("\""); |
|
return tmp; |
|
} |
|
|
|
// |
|
// Creates a message with source file name and line number. |
|
// |
static String _makeCIMExceptionMessage( | static String _makeCIMExceptionMessage( |
CIMStatusCode code, | CIMStatusCode code, |
|
const String& description, |
const char* file, | const char* file, |
Uint32 line, |
Uint32 line) |
const String& extraMessage) |
|
{ | { |
String tmp = file; | String tmp = file; |
tmp.append("("); | tmp.append("("); |
|
|
| |
tmp.append(CIMStatusCodeToString(code)); | tmp.append(CIMStatusCodeToString(code)); |
tmp.append(": \""); | tmp.append(": \""); |
tmp.append(extraMessage); |
tmp.append(description); |
tmp.append("\""); | tmp.append("\""); |
return tmp; | return tmp; |
} | } |
| |
|
// |
|
// Returns a message string specifically for tracing. |
|
// |
|
String CIMException::getTraceMessage() const |
|
{ |
|
String traceMsg = |
|
_makeCIMExceptionMessage(_code, _description, _file, _line); |
|
|
|
return traceMsg; |
|
} |
|
|
CIMException::CIMException( | CIMException::CIMException( |
CIMStatusCode code, | CIMStatusCode code, |
|
const String& description, |
const char* file, | const char* file, |
Uint32 line, |
Uint32 line) |
const String& extraMessage) |
: |
: Exception(_makeCIMExceptionMessage(code, file, line, extraMessage)), |
#ifdef DEBUG_CIMEXCEPTION |
_code(code) |
Exception(_makeCIMExceptionMessage(code, description, file, line)), |
|
#else |
|
Exception(_makeCIMExceptionMessage(code, description)), |
|
#endif |
|
_code(code), |
|
_description(description), |
|
_file(file), |
|
_line(line) |
{ | { |
| |
} | } |
| |
|
CIMException::CIMException(const CIMException& cimException) |
|
: Exception(cimException.getMessage()), |
|
_code(cimException._code), |
|
_description(cimException._description), |
|
_file(cimException._file), |
|
_line(cimException._line) |
|
{ |
|
} |
|
|
void ThrowUnitializedHandle() | void ThrowUnitializedHandle() |
{ | { |
throw UnitializedHandle(); | throw UnitializedHandle(); |