lastErrorToIOException
Retrieves the human-readable message for GetLastError via FormatMessageA and returns it as an IOException. When the last error is ERROR_FILE_NOT_FOUND or ERROR_PATH_NOT_FOUND, then this function will return FileNotFoundException. When the last error is ERROR_OPERATION_ABORTED, then this function will return InterruptedIOException. When the last error is ERROR_HANDLE_EOF, then this function returns EOFException.
Return
The formatted error as an IOException
See also
Retrieves the human-readable message for GetLastError via FormatMessageA and returns it as an IOException. When the last error is ERROR_FILE_NOT_FOUND or ERROR_PATH_NOT_FOUND, then this function will return FileNotFoundException.
If and only if the file parameter is non-null, an appropriate FileSystemException will be returned for the given last error.
ERROR_ACCESS_DENIED or ERROR_NOACCESS AccessDeniedException
ERROR_ALREADY_EXISTS or ERROR_FILE_EXISTS FileAlreadyExistsException
ERROR_NOT_EMPTY or ERROR_DIR_NOT_EMPTY DirectoryNotEmptyException
Else FileSystemException
Return
The formatted error as an IOException
Parameters
The File (if any) to associate this error with a FileSystemException
If multiple files were involved, such as a copy operation.