Merge pull request #4046 from CraftSpider/windows-error-mapping
Fill out windows io error mapping table
This commit is contained in:
commit
0267cbf672
1 changed files with 64 additions and 3 deletions
|
|
@ -82,11 +82,72 @@ const UNIX_IO_ERROR_TABLE: &[(&str, std::io::ErrorKind)] = {
|
|||
// <https://github.com/rust-lang/rust/blob/master/library/std/src/sys/pal/windows/mod.rs>.
|
||||
const WINDOWS_IO_ERROR_TABLE: &[(&str, std::io::ErrorKind)] = {
|
||||
use std::io::ErrorKind::*;
|
||||
// FIXME: this is still incomplete.
|
||||
// It's common for multiple error codes to map to the same io::ErrorKind. We have all for the
|
||||
// forwards mapping; only the first one will be used for the backwards mapping.
|
||||
// Slightly arbitrarily, we prefer non-WSA and the most generic sounding variant for backwards
|
||||
// mapping.
|
||||
&[
|
||||
("ERROR_ACCESS_DENIED", PermissionDenied),
|
||||
("ERROR_FILE_NOT_FOUND", NotFound),
|
||||
("WSAEADDRINUSE", AddrInUse),
|
||||
("WSAEADDRNOTAVAIL", AddrNotAvailable),
|
||||
("ERROR_ALREADY_EXISTS", AlreadyExists),
|
||||
("ERROR_FILE_EXISTS", AlreadyExists),
|
||||
("ERROR_NO_DATA", BrokenPipe),
|
||||
("WSAECONNABORTED", ConnectionAborted),
|
||||
("WSAECONNREFUSED", ConnectionRefused),
|
||||
("WSAECONNRESET", ConnectionReset),
|
||||
("ERROR_NOT_SAME_DEVICE", CrossesDevices),
|
||||
("ERROR_POSSIBLE_DEADLOCK", Deadlock),
|
||||
("ERROR_DIR_NOT_EMPTY", DirectoryNotEmpty),
|
||||
("ERROR_CANT_RESOLVE_FILENAME", FilesystemLoop),
|
||||
("ERROR_DISK_QUOTA_EXCEEDED", FilesystemQuotaExceeded),
|
||||
("WSAEDQUOT", FilesystemQuotaExceeded),
|
||||
("ERROR_FILE_TOO_LARGE", FileTooLarge),
|
||||
("ERROR_HOST_UNREACHABLE", HostUnreachable),
|
||||
("WSAEHOSTUNREACH", HostUnreachable),
|
||||
("ERROR_INVALID_NAME", InvalidFilename),
|
||||
("ERROR_BAD_PATHNAME", InvalidFilename),
|
||||
("ERROR_FILENAME_EXCED_RANGE", InvalidFilename),
|
||||
("ERROR_INVALID_PARAMETER", InvalidInput),
|
||||
("WSAEINVAL", InvalidInput),
|
||||
("ERROR_DIRECTORY_NOT_SUPPORTED", IsADirectory),
|
||||
("WSAENETDOWN", NetworkDown),
|
||||
("ERROR_NETWORK_UNREACHABLE", NetworkUnreachable),
|
||||
("WSAENETUNREACH", NetworkUnreachable),
|
||||
("ERROR_DIRECTORY", NotADirectory),
|
||||
("WSAENOTCONN", NotConnected),
|
||||
("ERROR_FILE_NOT_FOUND", NotFound),
|
||||
("ERROR_PATH_NOT_FOUND", NotFound),
|
||||
("ERROR_INVALID_DRIVE", NotFound),
|
||||
("ERROR_BAD_NETPATH", NotFound),
|
||||
("ERROR_BAD_NET_NAME", NotFound),
|
||||
("ERROR_SEEK_ON_DEVICE", NotSeekable),
|
||||
("ERROR_NOT_ENOUGH_MEMORY", OutOfMemory),
|
||||
("ERROR_OUTOFMEMORY", OutOfMemory),
|
||||
("ERROR_ACCESS_DENIED", PermissionDenied),
|
||||
("WSAEACCES", PermissionDenied),
|
||||
("ERROR_WRITE_PROTECT", ReadOnlyFilesystem),
|
||||
("ERROR_BUSY", ResourceBusy),
|
||||
("ERROR_DISK_FULL", StorageFull),
|
||||
("ERROR_HANDLE_DISK_FULL", StorageFull),
|
||||
("WAIT_TIMEOUT", TimedOut),
|
||||
("WSAETIMEDOUT", TimedOut),
|
||||
("ERROR_DRIVER_CANCEL_TIMEOUT", TimedOut),
|
||||
("ERROR_OPERATION_ABORTED", TimedOut),
|
||||
("ERROR_SERVICE_REQUEST_TIMEOUT", TimedOut),
|
||||
("ERROR_COUNTER_TIMEOUT", TimedOut),
|
||||
("ERROR_TIMEOUT", TimedOut),
|
||||
("ERROR_RESOURCE_CALL_TIMED_OUT", TimedOut),
|
||||
("ERROR_CTX_MODEM_RESPONSE_TIMEOUT", TimedOut),
|
||||
("ERROR_CTX_CLIENT_QUERY_TIMEOUT", TimedOut),
|
||||
("FRS_ERR_SYSVOL_POPULATE_TIMEOUT", TimedOut),
|
||||
("ERROR_DS_TIMELIMIT_EXCEEDED", TimedOut),
|
||||
("DNS_ERROR_RECORD_TIMED_OUT", TimedOut),
|
||||
("ERROR_IPSEC_IKE_TIMED_OUT", TimedOut),
|
||||
("ERROR_RUNLEVEL_SWITCH_TIMEOUT", TimedOut),
|
||||
("ERROR_RUNLEVEL_SWITCH_AGENT_TIMEOUT", TimedOut),
|
||||
("ERROR_TOO_MANY_LINKS", TooManyLinks),
|
||||
("ERROR_CALL_NOT_IMPLEMENTED", Unsupported),
|
||||
("WSAEWOULDBLOCK", WouldBlock),
|
||||
]
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue