winrt.system.hresult module¶
WinRT methods will raise OSError
exceptions when they fail with
OSError.winerror
set to an HRESULT
error code. This module contains some of the most common error codes used with
WinRT types, but it is not exhaustive (there are 1000s of known error codes!).
Added in version 3.2
Changed in version 4.0
The constants are HResults
rather than plain ints, so importing the module needs
winrt-Windows.Foundation.
Windows error codes¶
Most error codes are defined by Microsoft. Here are a few examples.
Note
Not all available members of this module are documented here. See the Python source code for the complete list.
S_OK¶
Operation successful.
E_FAIL¶
Unspecified error.
E_INVALIDARG¶
One or more arguments are invalid.
WIN32_ERROR_CANCELLED¶
The operation was canceled by the user.
PyWinRT error codes¶
The following error codes are specific to PyWinRT.
PYWINRT_E_UNRAISABLE_PYTHON_EXCEPTION¶
This error code is propagated when a Python exception is raised in a WinRT callback. It is not intended to be handled by the user. Instead the exception should be handled in the callback itself.
See also