| 341 | } |
| 342 | |
| 343 | PYCOM_EXPORT HRESULT PyCom_SetCOMErrorFromPyException(REFIID riid /* = IID_NULL */) |
| 344 | { |
| 345 | if (!PyErr_Occurred()) |
| 346 | // No error occurred |
| 347 | return S_OK; |
| 348 | |
| 349 | // These errors are generally 'unexpected' (ie, errors converting args on |
| 350 | // the way into a gateway method. If not explicitly raised by the user, |
| 351 | // log it. |
| 352 | PyCom_LoggerNonServerException(NULL, "Unexpected gateway error"); |
| 353 | |
| 354 | EXCEPINFO einfo; |
| 355 | PyCom_ExcepInfoFromPyException(&einfo); |
| 356 | |
| 357 | // force this to a failure just in case we couldn't extract a proper |
| 358 | // error value |
| 359 | if ( einfo.scode == S_OK ) |
| 360 | einfo.scode = E_FAIL; |
| 361 | |
| 362 | PyCom_SetCOMErrorFromExcepInfo(&einfo, riid); |
| 363 | PyCom_CleanupExcepInfo(&einfo); |
| 364 | return einfo.scode; |
| 365 | } |
| 366 | |
| 367 | PYCOM_EXPORT HRESULT PyCom_SetAndLogCOMErrorFromPyException(const char *methodName, REFIID riid /* = IID_NULL */) |
| 368 | { |
no test coverage detected