From b3864f8772b072e804954c1096510554ea578424 Mon Sep 17 00:00:00 2001 From: Vaclav Pavlin Date: Thu, 26 Oct 2023 10:46:08 +0200 Subject: [PATCH] fix: handle all empty responses in filter (#1688) --- packages/core/src/lib/filter/index.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/packages/core/src/lib/filter/index.ts b/packages/core/src/lib/filter/index.ts index 63202bd3eb..1f9a2384f4 100644 --- a/packages/core/src/lib/filter/index.ts +++ b/packages/core/src/lib/filter/index.ts @@ -184,6 +184,12 @@ class Subscription { async (source) => await all(source) ); + if (!res || !res.length) { + throw Error( + `No response received for request ${request.requestId}: ${res}` + ); + } + const { statusCode, requestId, statusDesc } = FilterSubscribeResponse.decode(res[0].slice()); @@ -216,6 +222,12 @@ class Subscription { async (source) => await all(source) ); + if (!res || !res.length) { + throw Error( + `No response received for request ${request.requestId}: ${res}` + ); + } + const { statusCode, requestId, statusDesc } = FilterSubscribeResponse.decode(res[0].slice());