DEV Community

ehmicky
ehmicky

Posted on

Show some πŸ–€ to Node.js process errors

Node.js prints process errors (uncaughtException, warning, unhandledRejection, rejectionHandled) on the console which is very useful. Unfortunately those errors:

  • do not show stack traces for warning and rejectionHandled making them hard to debug.
  • do not include multipleResolves errors (when a promise is resolved/rejected twice).
  • are inconvenient to log to an external service.
  • are hard to test.
  • cannot be conditionally skipped.
  • are printed each time an error is repeated (except for warning).
  • are not human-friendly.

I have created a library that fixes all those issues: log-process-errors.

Feel free to check it out at https://github.com/ehmicky/log-process-errors. Any feedback is welcome!

Top comments (0)