Eryk Sun <eryk...@gmail.com> added the comment:

How about doing something similar for Windows when winerror is set? This is a 
common case since many os functions use the Windows API directly. Showing the 
symbolic error name will help to disambiguate exceptions, such as 

    FileNotFoundError (ENOENT) from:

        ERROR_FILE_NOT_FOUND
        ERROR_PATH_NOT_FOUND
        ERROR_FILENAME_EXCED_RANGE
        ERROR_BAD_PATHNAME
        ERROR_BAD_NET_NAME

    PermissionError (EACCES) from:

        ERROR_ACCESS_DENIED
        ERROR_SHARING_VIOLATION
        ERROR_LOCK_VIOLATION
        ERROR_NETWORK_ACCESS_DENIED
        ERROR_NOT_READY

It could also support additional error codes that are common or used 
internally, such as 

    ERROR_NOT_SUPPORTED
    ERROR_INVALID_NAME
    ERROR_MOD_NOT_FOUND
    ERROR_PRIVILEGE_NOT_HELD
    ERROR_CANT_RESOLVE_FILENAME
    ERROR_INVALID_REPARSE_DATA

Modules/_winapi.c:

    ERROR_NETNAME_DELETED
    ERROR_SEM_TIMEOUT
    ERROR_PIPE_BUSY
    ERROR_MORE_DATA
    ERROR_PIPE_CONNECTED
    ERROR_OPERATION_ABORTED
    ERROR_IO_PENDING
    ERROR_NO_SYSTEM_RESOURCES

----------
nosy: +ZackerySpytz, eryksun

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue2920>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to