From 5cd383c45e56424df592833c79969a36fdcf12c1 Mon Sep 17 00:00:00 2001 From: Aleksandr Kraiz Date: Wed, 5 Apr 2023 13:26:16 +0400 Subject: [PATCH] Better error descriptions --- package.json | 2 +- src/services/OrionAggregator/ws/index.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 0ad6200..28f60be 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@orionprotocol/sdk", - "version": "0.18.4", + "version": "0.18.5", "description": "Orion Protocol SDK", "main": "./lib/index.cjs", "module": "./lib/index.js", diff --git a/src/services/OrionAggregator/ws/index.ts b/src/services/OrionAggregator/ws/index.ts index cf0affe..ec5cd96 100644 --- a/src/services/OrionAggregator/ws/index.ts +++ b/src/services/OrionAggregator/ws/index.ts @@ -373,9 +373,9 @@ class OrionAggregatorWS { const { id } = err; if (id !== undefined) { const subType = objectKeys(this.subscriptions).find((st) => this.subscriptions[st]?.[id]); - if (subType === undefined) throw new Error('OrionAggregatorWS: cannot find subscription type by id'); + if (subType === undefined) throw new Error(`OrionAggregatorWS: cannot find subscription type by id ${id}. Current subscriptions: ${JSON.stringify(this.subscriptions)}`); const sub = this.subscriptions[subType]?.[id]; - if (sub === undefined) throw new Error('OrionAggregatorWS: cannot find subscription by id'); + if (sub === undefined) throw new Error(`OrionAggregatorWS: cannot find subscription by id ${id}. Current subscriptions: ${JSON.stringify(this.subscriptions)}`); if ('errorCb' in sub) { sub.errorCb(err.m); }