Skip to content

Commit e99733f

Browse files
committed
sdk: return negentropy error code
1 parent f221dfc commit e99733f

File tree

1 file changed

+5
-2
lines changed
  • crates/nostr-sdk/src/relay

1 file changed

+5
-2
lines changed

crates/nostr-sdk/src/relay/mod.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ use std::time::Instant;
1818
#[cfg(not(target_arch = "wasm32"))]
1919
use async_utility::futures_util::stream::AbortHandle;
2020
use async_utility::{futures_util, thread, time};
21+
use nostr::message::relay::NegentropyErrorCode;
2122
use nostr::message::MessageHandleError;
2223
use nostr::negentropy::hex;
2324
use nostr::negentropy::{self, Bytes, Negentropy};
@@ -96,6 +97,9 @@ pub enum Error {
9697
/// Filters empty
9798
#[error("filters empty")]
9899
FiltersEmpty,
100+
/// Reconciliation error
101+
#[error("negentropy reconciliation error: {0}")]
102+
NegentropyReconciliation(NegentropyErrorCode),
99103
}
100104

101105
/// Relay connection status
@@ -1637,8 +1641,7 @@ impl Relay {
16371641
code,
16381642
} => {
16391643
if subscription_id == sub_id {
1640-
tracing::error!("Negentropy syncing error: {code}");
1641-
break;
1644+
return Err(Error::NegentropyReconciliation(code));
16421645
}
16431646
}
16441647
_ => (),

0 commit comments

Comments
 (0)