Skip to content

Commit

Permalink
sdk: return negentropy error code
Browse files Browse the repository at this point in the history
  • Loading branch information
yukibtc committed Sep 28, 2023
1 parent f221dfc commit e99733f
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions crates/nostr-sdk/src/relay/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -1637,8 +1641,7 @@ impl Relay {
code,
} => {
if subscription_id == sub_id {
tracing::error!("Negentropy syncing error: {code}");
break;
return Err(Error::NegentropyReconciliation(code));
}
}
_ => (),
Expand Down

0 comments on commit e99733f

Please sign in to comment.