Configuration for filtering, formatting, and handling stacks.
void
uncaughtException
fires when an exception bubbles to the event loop
without being caught. Registering a listener overrides Node’s default behavior
(printing the stack and exiting with code 1
). Handle with care. :contentReference[oaicite:0]{index=0}unhandledRejection
fires when a Promise rejects without a handler in
the same turn of the event loop. Useful for detecting missing .catch()
chains. :contentReference[oaicite:1]{index=1}Operational guidance
uncaughtException
, many production guides recommend logging, attempting
minimal cleanup, and then letting the process crash or exiting—don’t try to
continue in an unknown state. Use a supervisor (e.g., systemd/PM2) to restart. :contentReference[oaicite:2]{index=2}node --trace-warnings
can reveal
unhandled rejection origins. :contentReference[oaicite:3]{index=3}
Install global Node.js handlers for
uncaughtException
andunhandledRejection
.