From 1048846b5e093155b3370d9c9872df76d156ba35 Mon Sep 17 00:00:00 2001 From: Yuki Kishimoto Date: Sat, 16 Nov 2024 14:17:50 +0100 Subject: [PATCH] nwc: improve errors Signed-off-by: Yuki Kishimoto --- crates/nwc/src/error.rs | 5 ++++- crates/nwc/src/lib.rs | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/crates/nwc/src/error.rs b/crates/nwc/src/error.rs index 5b500dfae..1db7eab2b 100644 --- a/crates/nwc/src/error.rs +++ b/crates/nwc/src/error.rs @@ -18,8 +18,11 @@ pub enum Error { #[error(transparent)] NIP47(#[from] nip47::Error), /// Relay - #[error(transparent)] + #[error("relay: {0}")] Relay(#[from] nostr_relay_pool::relay::Error), + /// Premature exit from listener + #[error("premature exit from listener")] + PrematureExit, /// Request timeout #[error("timeout")] Timeout, diff --git a/crates/nwc/src/lib.rs b/crates/nwc/src/lib.rs index 4bb1771f8..29b59e07e 100644 --- a/crates/nwc/src/lib.rs +++ b/crates/nwc/src/lib.rs @@ -117,7 +117,7 @@ impl NWC { } } - Err(Error::Timeout) + Err(Error::PrematureExit) }) .await .ok_or(Error::Timeout)?