From e99733f369bfd3392c3b0685a82a83d471cf2ec9 Mon Sep 17 00:00:00 2001 From: Yuki Kishimoto Date: Thu, 28 Sep 2023 12:33:31 +0200 Subject: [PATCH] sdk: return negentropy error code --- crates/nostr-sdk/src/relay/mod.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/crates/nostr-sdk/src/relay/mod.rs b/crates/nostr-sdk/src/relay/mod.rs index 2a4e051bd..9bc35acba 100644 --- a/crates/nostr-sdk/src/relay/mod.rs +++ b/crates/nostr-sdk/src/relay/mod.rs @@ -18,6 +18,7 @@ use std::time::Instant; #[cfg(not(target_arch = "wasm32"))] use async_utility::futures_util::stream::AbortHandle; use async_utility::{futures_util, thread, time}; +use nostr::message::relay::NegentropyErrorCode; use nostr::message::MessageHandleError; use nostr::negentropy::hex; use nostr::negentropy::{self, Bytes, Negentropy}; @@ -96,6 +97,9 @@ pub enum Error { /// Filters empty #[error("filters empty")] FiltersEmpty, + /// Reconciliation error + #[error("negentropy reconciliation error: {0}")] + NegentropyReconciliation(NegentropyErrorCode), } /// Relay connection status @@ -1637,8 +1641,7 @@ impl Relay { code, } => { if subscription_id == sub_id { - tracing::error!("Negentropy syncing error: {code}"); - break; + return Err(Error::NegentropyReconciliation(code)); } } _ => (),