From f70adbd4cc69c12c039c8114034160c108df16b3 Mon Sep 17 00:00:00 2001 From: James Wilson Date: Fri, 23 Feb 2024 12:29:24 +0000 Subject: [PATCH 1/2] Handle errors when fetching storage keys from Unstablebackend --- subxt/src/backend/unstable/storage_items.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/subxt/src/backend/unstable/storage_items.rs b/subxt/src/backend/unstable/storage_items.rs index 73790765ea..37fb068670 100644 --- a/subxt/src/backend/unstable/storage_items.rs +++ b/subxt/src/backend/unstable/storage_items.rs @@ -149,6 +149,13 @@ impl Stream for StorageItems { // We have items; buffer them to emit next loops. self.buffered_responses = items.items; continue; + }, + FollowEvent::OperationError(err) + if err.operation_id == *self.operation_id => + { + // Something went wrong obtaining storage items; mark as done and return the error. + self.done = true; + return Poll::Ready(Some(Err(Error::Other(err.error)))) } _ => { // We don't care about this event; wait for the next. From c16a70504b1e0aaf6db85d11a7832ac64675afea Mon Sep 17 00:00:00 2001 From: James Wilson Date: Fri, 23 Feb 2024 12:31:22 +0000 Subject: [PATCH 2/2] cargo fmt --- subxt/src/backend/unstable/storage_items.rs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/subxt/src/backend/unstable/storage_items.rs b/subxt/src/backend/unstable/storage_items.rs index 37fb068670..20464236cd 100644 --- a/subxt/src/backend/unstable/storage_items.rs +++ b/subxt/src/backend/unstable/storage_items.rs @@ -149,13 +149,11 @@ impl Stream for StorageItems { // We have items; buffer them to emit next loops. self.buffered_responses = items.items; continue; - }, - FollowEvent::OperationError(err) - if err.operation_id == *self.operation_id => - { + } + FollowEvent::OperationError(err) if err.operation_id == *self.operation_id => { // Something went wrong obtaining storage items; mark as done and return the error. self.done = true; - return Poll::Ready(Some(Err(Error::Other(err.error)))) + return Poll::Ready(Some(Err(Error::Other(err.error)))); } _ => { // We don't care about this event; wait for the next.