OnUnhandledRejection
Registers handlers to capture global unhandled promise rejections. (default)
This integration only works inside server environments (Node.js, Bun, Deno).
Import name: Sentry.onUnhandledRejectionIntegration
This integration is enabled by default. If you'd like to modify your default integrations, read this.
The onUnhandledRejectionIntegration
registers handlers to capture global unhandled promise rejections.
Copied
Sentry.init({
integrations: [Sentry.onUnhandledRejectionIntegration()],
});
Type: 'none' | 'warn' | 'strict'
This option defines what to do after capturing an unhandled rejection and mimics the behavior of node's --unhandled-rejection
flag:
strict
: Raise the unhandled rejection as an uncaught exception. If the exception is handled, unhandledRejection is emitted.warn
: Always trigger a warning, no matter if the unhandledRejection hook is set or not but do not print the deprecation warning.none
: Silence all warnings.
Defaults to none
.
Help improve this content
Our documentation is open source and available on GitHub. Your contributions are welcome, whether fixing a typo (drat!) or suggesting an update ("yeah, this would be better").
Our documentation is open source and available on GitHub. Your contributions are welcome, whether fixing a typo (drat!) or suggesting an update ("yeah, this would be better").