Update of /cvsroot/pywin32/pywin32/com/win32com/src/include
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14371/include
Modified Files:
PythonCOM.h PythonCOMServer.h
Log Message:
Move towards clearer error handling using the logging module features.
Remove old deprecated methods, remove public declarations of private
methods and add new MAKE_PYCOM_GATEWAY_FAILURE_CODE which all gateways
should use.
Index: PythonCOMServer.h
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32com/src/include/PythonCOMServer.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** PythonCOMServer.h 20 Jan 2003 23:19:28 -0000 1.4
--- PythonCOMServer.h 25 Jan 2005 13:33:16 -0000 1.5
***************
*** 150,154 ****
// B/W compat hack for gateways.
! #define PyCom_HandlePythonFailureToCOM() PyCom_SetCOMErrorFromPyException(GetIID())
--- 150,161 ----
// B/W compat hack for gateways.
! #define PyCom_HandlePythonFailureToCOM() \
! PyCom_SetAndLogCOMErrorFromPyExceptionEx(this->m_pPyObject, "gateway method", GetIID())
!
! // F/W compat hack for gateways! Must be careful about updating
! // PyGatewayBase vtable, so a slightly older pythoncomXX.dll will work
! // with slightly later extensions. So use a #define.
! #define MAKE_PYCOM_GATEWAY_FAILURE_CODE(method_name) \
! PyCom_SetAndLogCOMErrorFromPyExceptionEx(this->m_pPyObject, method_name, GetIID())
Index: PythonCOM.h
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32com/src/include/PythonCOM.h,v
retrieving revision 1.21
retrieving revision 1.22
diff -C2 -d -r1.21 -r1.22
*** PythonCOM.h 7 Sep 2004 02:19:27 -0000 1.21
--- PythonCOM.h 25 Jan 2005 13:33:16 -0000 1.22
***************
*** 302,317 ****
PYCOM_EXPORT PyObject* PyCom_BuildInternalPyException(char *msg);
- // The old names, for b/w compat - but we have purged it
- // from the COM core, so we may as well remove it completely from the core :-)
- #ifndef BUILD_PYTHONCOM
- #define OleSetOleError PyCom_BuildPyException
- #endif
-
- // Log an internal error, including traceback.
- PYCOM_EXPORT void PyCom_LogError(const char *fmt, ...);
-
- // Log an error if not a COM Server exception, including traceback.
- PYCOM_EXPORT void PyCom_LogNonServerError(const char *fmt, ...);
-
// Log an error to a Python logger object if one can be found, or
// to stderr if no log available.
--- 302,305 ----
***************
*** 320,324 ****
// If they do not exist, return None, or raise an error fetching them
// (or even writing to them once fetched), the message still goes to stderr.
! // NOTE: By default, win32com does *not* provide a logger.
PYCOM_EXPORT void PyCom_LoggerNonServerException(PyObject *logProvider,
const char *fmt, ...);
--- 308,313 ----
// If they do not exist, return None, or raise an error fetching them
// (or even writing to them once fetched), the message still goes to stderr.
! // NOTE: By default, win32com does *not* provide a logger, so default is that
! // all errors are written to stdout.
PYCOM_EXPORT void PyCom_LoggerNonServerException(PyObject *logProvider,
const char *fmt, ...);
***************
*** 326,333 ****
PYCOM_EXPORT void PyCom_LoggerException(PyObject *logProvider, const char *fmt, ...);
- // Write a raw string to the error device.
- PYCOM_EXPORT void PyCom_StreamMessage(const char *msg);
-
-
// Server related error functions
// These are supplied so that any Python errors we detect can be
--- 315,318 ----
***************
*** 347,352 ****
PYCOM_EXPORT HRESULT PyCom_SetCOMErrorFromSimple(HRESULT hr, REFIID riid = IID_NULL, const char *description = NULL);
! // Used in gateways to SetErrorInfo() the current Python exception
! // NOTE: this function assumes it is operating within the Python context
PYCOM_EXPORT HRESULT PyCom_SetCOMErrorFromPyException(REFIID riid = IID_NULL);
--- 332,339 ----
PYCOM_EXPORT HRESULT PyCom_SetCOMErrorFromSimple(HRESULT hr, REFIID riid = IID_NULL, const char *description = NULL);
! // Used in gateways to SetErrorInfo() the current Python exception, and
! // (assuming not a server error explicitly raised) also logs an error
! // to stdout/win32com.logger.
! // NOTE: this function assumes GIL held
PYCOM_EXPORT HRESULT PyCom_SetCOMErrorFromPyException(REFIID riid = IID_NULL);
***************
*** 369,384 ****
PYCOM_EXPORT PyObject *PyCom_PyObjectFromExcepInfo(const EXCEPINFO *pexcepInfo);
- // Used by gateways to SetErrorInfo() from the data contained in an EXCEPINFO
- // structure. Mainly used internally, but handy for functions that have special
- // error requirements (particularly those with IDispatch::Invoke() semantics -
- // ie, you have an EXCEPINFO structure, but it turns out you can't return it
- // as the HRESULT will not be DISP_E_EXCEPTION - therefore you can make the
- // EXCEPINFO data available via SetErrorInfo() just incase the client can use it
- PYCOM_EXPORT BOOL PyCom_SetCOMErrorFromExcepInfo(const EXCEPINFO *pexcepinfo, REFIID riid);
-
- // Free the strings etc in an EXCEPINFO
- PYCOM_EXPORT void PyCom_CleanupExcepInfo(EXCEPINFO *pexcepinfo);
-
-
///////////////////////////////////////////////////////////////////
//
--- 356,359 ----
|