00001
00011 #include "O3DBIException.h"
00012
00013 #pragma warning(push, 4)
00014
00016
00018
00019 O3DBIException::O3DBIException(long lErrorNumber,
00020 PC_TCHAR pchErrorText,
00021 PC_TCHAR pchFailedMethodName,
00022 const TO3DBIObjectPtr pObjectAddress)
00023 {
00024 _lErrorNumber = lErrorNumber;
00025 if (pchErrorText != NULL)
00026 _pchErrorText = ::_tcsdup(pchErrorText);
00027 if (_pchErrorText == NULL)
00028 throw _T("Memory allocation failure!");
00029 if (pchFailedMethodName != NULL)
00030 _pchFailedMethodName = ::_tcsdup(pchFailedMethodName);
00031 if (_pchFailedMethodName == NULL)
00032 throw _T("Memory allocation failure!");
00033 _pObjectAddress = pObjectAddress;
00034 }
00035
00036 O3DBIException::~O3DBIException()
00037 {
00038 if (_pchErrorText != NULL)
00039 {
00040 ::free(reinterpret_cast<void*>(_pchErrorText));
00041 _pchErrorText = NULL;
00042 }
00043 if (_pchFailedMethodName != NULL)
00044 {
00045 ::free(reinterpret_cast<void*>(_pchFailedMethodName));
00046 _pchFailedMethodName = NULL;
00047 }
00048 }
00049
00050 long O3DBIException::GetErrorNumber() const
00051 {
00052 return _lErrorNumber;
00053 }
00054
00055 PC_TCHAR O3DBIException::GetErrorText() const
00056 {
00057 return _pchErrorText;
00058 }
00059
00060 PC_TCHAR O3DBIException::GetFailedMethodName() const
00061 {
00062 return _pchFailedMethodName;
00063 }
00064
00065 const TO3DBIObjectPtr O3DBIException::GetObjectAddress() const
00066 {
00067 return _pObjectAddress;
00068 }
00069
00070 #pragma warning(pop)