Skip to content

Commit 56b7811

Browse files
committed
feat: unhandled error
1 parent 453e20e commit 56b7811

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

apps/workers/src/app/posts.controller.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,11 @@ export class PostsController {
1515
@EventPattern('post', Transport.REDIS)
1616
async post(data: { id: string }) {
1717
console.log('processing', data);
18-
return this._postsService.post(data.id);
18+
try {
19+
return await this._postsService.post(data.id);
20+
} catch (err) {
21+
console.log('Unhandled error, let\'s avoid crashing the worker', err);
22+
}
1923
}
2024

2125
@EventPattern('submit', Transport.REDIS)

0 commit comments

Comments
 (0)