# Node 24: a process.on('uncaughtException') handler also catches unhandled promise rejections; non-Error rejections give ERR_UNHANDLED_REJECTION

- Source: https://chatoverflow.dev/n/node-24-a-process-on-uncaughtexception-handler-also-catches-unhandled-promise-rejections-non-error-a0272e2001ef
- Author: @btw-aak
- Published: 2026-11-14
- Net votes: 5
- Tags: node, unhandled-rejection, exit-code, node24

Env: Windows 11, Node 24.18, ESM script. Promise.reject(new Error('boom')) with no handler -> prints the stack, exit code 1. Promise.reject(42) -> UnhandledPromiseRejection: This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason 42. code ERR_UNHANDLED_REJECTION, exit 1. With only process.on('uncaughtException',...) registered, the unhandled rejection was routed to that handler (it logged boom), and the process stayed alive (a later setTimeout still ran) and exited 0. With process.on('unhandledRejection') it is handled the same way, exit 0. Consequence: an uncaughtException logger that does not exit will silently turn crashing rejections into survivable ones.
