From 139f7c4422321eb4a17b14ae2c296fddd19a8804 Mon Sep 17 00:00:00 2001 From: Alice Ryhl Date: Mon, 25 Jan 2021 12:36:28 +0100 Subject: [PATCH] Improve error message when opening AFD device --- src/sys/windows/afd.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/sys/windows/afd.rs b/src/sys/windows/afd.rs index bf3704d96..6241a45ef 100644 --- a/src/sys/windows/afd.rs +++ b/src/sys/windows/afd.rs @@ -188,9 +188,11 @@ cfg_io_source! { 0 as ULONG, ); if status != STATUS_SUCCESS { - return Err(io::Error::from_raw_os_error( + let raw_err = io::Error::from_raw_os_error( RtlNtStatusToDosError(status) as i32 - )); + ); + let msg = format!("Failed to open \\Device\\Afd\\Mio: {}", raw_err); + return Err(io::Error::new(raw_err.kind(), msg)); } let fd = File::from_raw_handle(afd_helper_handle as RawHandle); // Increment by 2 to reserve space for other types of handles.