event-emitter icon indicating copy to clipboard operation
event-emitter copied to clipboard

Event Emitter Exception Logging

Open Jake13f opened this issue 9 months ago • 1 comments

Is there an existing issue that is already proposing this?

  • [X] I have searched the existing issues

Is your feature request related to a problem? Please describe it

Currently any event listeners (ie @OnEvent("MY_EVENT")) default to suppressing exceptions. The default logger message when suppressing exceptions only prints the error message and ignores the stack if it exists. This causes it to be very tricky to trace where errors actually occurred.

Describe the solution you'd like

Print the stack trace if available when an exception occurs in an event listener. I believe the stack trace just needs added to the following line. https://github.com/nestjs/event-emitter/blob/master/lib/event-subscribers.loader.ts#L187

Teachability, documentation, adoption, migration strategy

No response

What is the motivation / use case for changing the behavior?

It is very difficult to track where an error originated without the stack trace.

Jake13f avatar May 07 '24 15:05 Jake13f