NestJS · Senior · Question 32 of 75
Why should errors in event handlers (@OnEvent) be handled carefully?
- 1Event handlers retry automatically
- ✓Correct answer: Handlers run in-process; an exception may be unhandled or lost, and there is no retry, so use try/catch, logging or a durable queue
- 3Errors in handlers stop the event emitter forever
Explanation
For important side effects, emit to a queue instead of relying on in-memory events.