OnUncaughtException

Registers handlers to capture global uncaught exceptions. (default)

Import name: Sentry.onUncaughtExceptionIntegration

This integration is enabled by default. If you'd like to modify your default integrations, read this.

The onUncaughtExceptionIntegration registers handlers to capture global uncaught exceptions that would cause the process to exit.

This integration does not prevent the process from exiting! If you want to prevent the process from exiting, you should register your own uncaught exception handler and configure exitEvenIfOtherHandlersAreRegistered: false in the integration options.

Copied
Sentry.init({
  integrations: [Sentry.onUncaughtExceptionIntegration()],
});

Type: boolean

If set to false, the SDK will not exit if we detect that another uncaught exception handler is registered.

Type: (firstError: Error, secondError: Error | undefined) => void

This method is called when an uncaught error would cause the process to exit. secondError will be set if the handler was called multiple times. This can happen either because onFatalError itself threw, or because an independent error happened somewhere else while onFatalError was running.

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").