Overview
uncaughtExceptionIntegration listens for the process's uncaughtException and unhandledRejection events and reports each one through captureException(). It's the only integration enabled by default — the Node counterpart of the browser's globalErrorIntegration.
After reporting, it flushes everything the transport still has buffered, prints the error to stderr and exits with code 1 — the same thing Node does on its own for an uncaught error, since the process is in an undefined state afterwards.
A rejection whose reason isn't an Error (e.g. Promise.reject('nope')) is wrapped in one, so it still gets a name, message and stack.
Usage
Nothing to do — it's registered by init() automatically. To turn it off (for example, when your framework already has its own crash handler):
ts
import { disable, init } from '@buglapse/node'
disable('uncaught-exception')
init({ dsn: '{dsn}' })To replace it with your own implementation, pass an integration named 'uncaught-exception' in init({ integrations }) — see Create integration.