From af1a3385cccb4286dac70baa2e314a82d4d15974 Mon Sep 17 00:00:00 2001 From: Jaco Greeff Date: Mon, 2 Mar 2020 09:09:27 +0100 Subject: [PATCH] Raise error on parsing errors (#1987) --- CHANGELOG.md | 1 + packages/rpc-core/src/index.ts | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5548b633b0..643998483d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ # 1.5.0-beta.x - Add proper support for type generation with an Enum containing an Tuple (Thanks to https://github.com/monitz87) +- Fix storage parsing not resulting in rejected Promises (Fix from https://github.com/aniiantt applied) - Type generation will now handle the same sub-module name across packages, i.e. `@polkadot/types/interfaces/runtime` & `@mine/interfaces/runtime`) - Add `.range([from, to]: [Hash, Hash?], ...args: any[]): [Hash, Codec][]` on all storage entries - Allow `BTreeMap` to be initialized with a `Record` object (in addition to `Map`) diff --git a/packages/rpc-core/src/index.ts b/packages/rpc-core/src/index.ts index 02d3d45f70..0be738d754 100644 --- a/packages/rpc-core/src/index.ts +++ b/packages/rpc-core/src/index.ts @@ -253,7 +253,11 @@ export default class Rpc implements RpcInterface { return; } - observer.next(this.formatOutput(method, params, result)); + try { + observer.next(this.formatOutput(method, params, result)); + } catch (error) { + observer.error(error); + } }; subscriptionPromise = this.createSubscriber({ subType, subName, paramsJson, update }, errorHandler);