Skip to content

Commit

Permalink
fix: avoid crash when an unexpected message arrives
Browse files Browse the repository at this point in the history
Signed-off-by: Pavel Zarecky <zarecky@procivis.ch>
  • Loading branch information
Pavel Zarecky committed Sep 8, 2022
1 parent f487182 commit 42662a2
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion packages/core/src/agent/Agent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,13 @@ export class Agent {
.observable<AgentMessageReceivedEvent>(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()
}
Expand Down

0 comments on commit 42662a2

Please sign in to comment.