feat: unhandled error

This commit is contained in:
Nevo David 2025-07-21 12:17:56 +07:00
parent 453e20e418
commit 56b78111a7
1 changed files with 5 additions and 1 deletions

View File

@ -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)