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

Diff for /pegasus/src/Pegasus/Common/Exception.cpp between version 1.52 and 1.53

version 1.52, 2002/08/16 01:28:06 version 1.53, 2002/08/16 22:48:29
Line 33 
Line 33 
  
 #include <cstdio> #include <cstdio>
 #include "Exception.h" #include "Exception.h"
   #include <Pegasus/Common/CIMExceptionRep.h>
 #include "Tracer.h" #include "Tracer.h"
  
 PEGASUS_NAMESPACE_BEGIN PEGASUS_NAMESPACE_BEGIN
Line 111 
Line 112 
 // //
 //////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
  
 //  CIMException::CIMException(
 // Creates a description without source file name and line number.  
 //  
 static String _makeCIMExceptionDescription(  
     CIMStatusCode code,     CIMStatusCode code,
     const String& message)     const String& message)
       :
       Exception(message)
 { {
     String tmp;      _rep = new CIMExceptionRep();
     tmp.append(cimStatusCodeToString(code));      _rep->code = code;
     if (message != String::EMPTY)      _rep->file = "";
     {      _rep->line = 0;
         tmp.append(": \"");  
         tmp.append(message);  
         tmp.append("\"");  
     }  
     return tmp;  
 } }
  
 //  CIMException::CIMException(const CIMException & cimException)
 // Creates a description with source file name and line number.      : Exception(cimException.getMessage())
 //  {
 static String _makeCIMExceptionDescription(      _rep = new CIMExceptionRep();
     CIMStatusCode code,      _rep->code = cimException._rep->code;
     const String& message,      _rep->file = cimException._rep->file;
     const char* file,      _rep->line = cimException._rep->line;
     Uint32 line)  
 {  
     String tmp = file;  
     tmp.append("(");  
     char buffer[32];  
     sprintf(buffer, "%d", line);  
     tmp.append(buffer);  
     tmp.append("): ");  
     tmp.append(_makeCIMExceptionDescription(code, message));  
     return tmp;  
 } }
  
 CIMException::CIMException(  CIMException& CIMException::operator=(const CIMException & cimException)
     CIMStatusCode code,  
     const String& message,  
     const char* file,  
     Uint32 line)  
     :  
     Exception(message),  
     _code(code),  
     _file(file),  
     _line(line)  
 { {
       _message = cimException._message;
       _rep->code = cimException._rep->code;
       _rep->file = cimException._rep->file;
       _rep->line = cimException._rep->line;
       return *this;
 } }
  
 //  CIMException::~CIMException()
 // Returns a description string fit for human consumption  
 //  
 String CIMException::getDescription() const  
 { {
 #ifdef DEBUG_CIMEXCEPTION      delete _rep;
     return getTraceDescription();  
 #else  
     return _makeCIMExceptionDescription(_code, getMessage());  
 #endif  
 } }
  
 //  CIMStatusCode CIMException::getCode() const
 // Returns a description string with filename and line number information  
 // specifically for tracing.  
 //  
 String CIMException::getTraceDescription() const  
 { {
     String traceDescription =      return _rep->code;
         _makeCIMExceptionDescription(_code, getMessage(), _file, _line);  
   
     return traceDescription;  
 } }
  
 PEGASUS_NAMESPACE_END PEGASUS_NAMESPACE_END


Legend:
Removed from v.1.52  
changed lines
  Added in v.1.53

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2