From 42662a2573a102f55c1510955b3f92213bd2c0e4 Mon Sep 17 00:00:00 2001 From: Pavel Zarecky Date: Thu, 8 Sep 2022 10:37:27 +0200 Subject: [PATCH] fix: avoid crash when an unexpected message arrives Signed-off-by: Pavel Zarecky --- packages/core/src/agent/Agent.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/core/src/agent/Agent.ts b/packages/core/src/agent/Agent.ts index dc9da53e93..013c5d02fa 100644 --- a/packages/core/src/agent/Agent.ts +++ b/packages/core/src/agent/Agent.ts @@ -134,7 +134,13 @@ export class Agent { .observable(AgentEventTypes.AgentMessageReceived) .pipe( takeUntil(this.agentConfig.stop$), - concatMap((e) => this.messageReceiver.receiveMessage(e.payload.message, { connection: e.payload.connection })) + concatMap((e) => + this.messageReceiver + .receiveMessage(e.payload.message, { connection: e.payload.connection }) + .catch((error) => { + this.logger.error('Failed to process message', { error }) + }) + ) ) .subscribe() }