From cb25d13028ec1cdf986a3567ea52562ea654a7b8 Mon Sep 17 00:00:00 2001 From: Michael Davis Date: Tue, 23 Jan 2024 13:36:53 -0500 Subject: Improve error handling for `which::which` failures Co-authored-by: Pascal Kuthe --- helix-dap/src/client.rs | 2 +- helix-dap/src/lib.rs | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) (limited to 'helix-dap') diff --git a/helix-dap/src/client.rs b/helix-dap/src/client.rs index 579811df..18af13ae 100644 --- a/helix-dap/src/client.rs +++ b/helix-dap/src/client.rs @@ -113,7 +113,7 @@ impl Client { id: usize, ) -> Result<(Self, UnboundedReceiver)> { // Resolve path to the binary - let cmd = helix_stdx::env::which(cmd).map_err(|err| anyhow::anyhow!(err))?; + let cmd = helix_stdx::env::which(cmd)?; let process = Command::new(cmd) .args(args) diff --git a/helix-dap/src/lib.rs b/helix-dap/src/lib.rs index 21162cb8..d0229249 100644 --- a/helix-dap/src/lib.rs +++ b/helix-dap/src/lib.rs @@ -19,6 +19,8 @@ pub enum Error { #[error("server closed the stream")] StreamClosed, #[error(transparent)] + ExecutableNotFound(#[from] helix_stdx::env::ExecutableNotFoundError), + #[error(transparent)] Other(#[from] anyhow::Error), } pub type Result = core::result::Result; -- cgit v1.2.3-70-g09d2