uncaughtExceptionMonitor
A Node.js process event emitted just before an uncaught exception is handled, letting you record it without stopping the crash.
In more detail
It is the right hook for crash reporting. Log synchronously there, because the process may exit immediately afterwards.
Related terms
- uncaughtException — The Node.js process event emitted when an error is thrown and nothing catches it; by default the process prints the stack trace and exits with code 1.
- diagnostic report — A JSON summary of a Node.js process's state, including stacks, heap statistics, resource usage and loaded libraries, written on demand or on a crash.
- fs.writeSync() — The Node.js function that writes to a file descriptor and returns only when the write is done, blocking the thread meanwhile.
Taught in
- Global Error Trapping: uncaughtException & Exits — Node.js Internals & Backend Services