Skip to content

GlobalHandlers | Sentry for Next.js

Source URL: https://docs.sentry.io/platforms/javascript/guides/nextjs/configuration/integrations/globalhandlers

This integration only works in the Browser and Deno runtimes.

Import name: Sentry.globalHandlersIntegration

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

This integration attaches global handlers to capture uncaught exceptions and unhandled rejections. It captures errors and unhandled promise rejections by default.

Sentry.init({
integrations: [Sentry.globalHandlersIntegration({ onerror: true, onunhandledrejection: true })],
});

Type: boolean

Capture errors bubbled to onerror.

Type: boolean

Capture unhandled promise rejections.