diff --git a/src/pages/Storage/StorageSubscriptions.tsx b/src/pages/Storage/StorageSubscriptions.tsx
index 00cc60b..3851328 100644
--- a/src/pages/Storage/StorageSubscriptions.tsx
+++ b/src/pages/Storage/StorageSubscriptions.tsx
@@ -100,6 +100,13 @@ const DecodedResultDisplay: FC<{
storageSubscription: StorageSubscription
subscriptionKey: string
}> = ({ storageSubscription, subscriptionKey }) => {
+ if ("error" in storageSubscription) {
+ return (
+
+ {storageSubscription.error}
+
+ )
+ }
if (!("result" in storageSubscription)) {
return Loading…
}
@@ -170,6 +177,14 @@ const DecodedResultDisplay: FC<{
const JsonResultDisplay: FC<{
storageSubscription: StorageSubscription
}> = ({ storageSubscription }) => {
+ if ("error" in storageSubscription) {
+ return (
+
+ {storageSubscription.error}
+
+ )
+ }
+
if (!("result" in storageSubscription)) {
return Loading…
}
diff --git a/src/pages/Storage/storage.state.ts b/src/pages/Storage/storage.state.ts
index 2b09c1d..bc112d6 100644
--- a/src/pages/Storage/storage.state.ts
+++ b/src/pages/Storage/storage.state.ts
@@ -11,6 +11,7 @@ import {
} from "@react-rxjs/utils"
import { Binary } from "polkadot-api"
import {
+ catchError,
combineLatest,
concat,
distinctUntilChanged,
@@ -168,7 +169,8 @@ export type StorageSubscription = {
single: boolean
paused: boolean
completed: boolean
-} & ({ result: unknown } | {})
+} & ({ result: unknown } | { error: string } | {})
+
const [getStorageSubscription$, storageSubscriptionKeyChange$] = partitionByKey(
newStorageSubscription$,
() => uuid(),
@@ -198,6 +200,18 @@ const [getStorageSubscription$, storageSubscriptionKeyChange$] = partitionByKey(
paused,
completed,
})),
+ catchError((ex) => {
+ console.error(ex)
+ return [
+ {
+ ...props,
+ paused: false,
+ completed: true,
+ error:
+ ex instanceof Error ? `Error: ${ex.message}` : "(Errored)",
+ } satisfies StorageSubscription,
+ ]
+ }),
)
}),
takeUntil(merge(removeStorageSubscription$(id), selectedChainChanged$)),