From 56b78111a7c7355934c95f9a67854e8e76a26687 Mon Sep 17 00:00:00 2001 From: Nevo David Date: Mon, 21 Jul 2025 12:17:56 +0700 Subject: [PATCH] feat: unhandled error --- apps/workers/src/app/posts.controller.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/apps/workers/src/app/posts.controller.ts b/apps/workers/src/app/posts.controller.ts index 613797ed..19fe9b51 100644 --- a/apps/workers/src/app/posts.controller.ts +++ b/apps/workers/src/app/posts.controller.ts @@ -15,7 +15,11 @@ export class PostsController { @EventPattern('post', Transport.REDIS) async post(data: { id: string }) { console.log('processing', data); - return this._postsService.post(data.id); + try { + return await this._postsService.post(data.id); + } catch (err) { + console.log('Unhandled error, let\'s avoid crashing the worker', err); + } } @EventPattern('submit', Transport.REDIS)