From 7214f019550c6c8766b65c145640d34d5550db78 Mon Sep 17 00:00:00 2001 From: Alyssa Ross Date: Mon, 6 Jul 2020 16:16:41 +0000 Subject: devices: include path in SocketConnect error msg --- devices/src/virtio/wl.rs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/devices/src/virtio/wl.rs b/devices/src/virtio/wl.rs index d21fa35..12f5012 100644 --- a/devices/src/virtio/wl.rs +++ b/devices/src/virtio/wl.rs @@ -316,7 +316,7 @@ enum WlError { NewAlloc(Error), NewPipe(Error), AllocSetSize(Error), - SocketConnect(io::Error), + SocketConnect { path: PathBuf, inner: io::Error }, SocketNonBlock(io::Error), VmControl(MsgError), VmBadResponse, @@ -342,7 +342,9 @@ impl Display for WlError { NewAlloc(e) => write!(f, "failed to create shared memory allocation: {}", e), NewPipe(e) => write!(f, "failed to create pipe: {}", e), AllocSetSize(e) => write!(f, "failed to set size of shared memory: {}", e), - SocketConnect(e) => write!(f, "failed to connect socket: {}", e), + SocketConnect { path, inner } => { + write!(f, "failed to connect socket at {:?}: {}", path, inner) + } SocketNonBlock(e) => write!(f, "failed to set socket as non-blocking: {}", e), VmControl(e) => write!(f, "failed to control parent VM: {}", e), VmBadResponse => write!(f, "invalid response from parent VM"), @@ -600,7 +602,11 @@ impl fmt::Debug for WlVfd { impl WlVfd { fn connect>(path: P) -> WlResult { - let socket = UnixStream::connect(path).map_err(WlError::SocketConnect)?; + let path = path.as_ref(); + let socket = UnixStream::connect(path).map_err(|e| WlError::SocketConnect { + path: path.to_path_buf(), + inner: e, + })?; let mut vfd = WlVfd::default(); vfd.socket = Some(socket); Ok(vfd) -- cgit 1.4.1