DEV Community

ehmicky
ehmicky

Posted on

2 1

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)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

šŸ‘‹ Kindness is contagious

Please leave a ā¤ļø or a friendly comment on this post if you found it helpful!

Okay