Skip to main content

react-native-global-exception-handler

Handle JS and native crashes
in React Native

react-native-global-exception-handler gives React Native teams one place to catch uncaught JavaScript exceptions, handle native crashes, trigger fallback flows, and send reports to Sentry, Crashlytics, or custom backends.

npm install react-native-global-exception-handlernpm install react-native-global-exception-handler
example.ts
import {
  setJSExceptionHandler,
  setNativeExceptionHandler,
} from 'react-native-global-exception-handler';

setJSExceptionHandler((err, fatal) => {
  // report + graceful UI
}, true);

setNativeExceptionHandler(msg => {
  // send to analytics
});

Watch React Native crash handling in action

See the library log native failures, show fallback UI, and prove out production crash flows on both iOS and Android.

iOS Demo

Test native crash handling with built-in simulation tools and validate what iOS can safely do after a fatal exception.

Android Demo

Android can log the failure, show crash details, and support restart-oriented recovery flows when your app needs them.

Why teams install this React Native crash handler

Catch the failures that matter, give users a better fallback path, and connect your monitoring stack without inventing a crash pipeline from scratch.

Modern Architecture

Built with TurboModules support for React Native 0.68+ so teams can add crash handling without giving up compatibility with legacy or new architecture apps.

  • Works with old and new architecture projects
  • Fast install path for supported React Native versions
  • Solid fit for long-lived apps

Dual Exception Handling

Catch JavaScript and native exceptions through one API surface so your team can stop piecing together separate crash flows.

  • One place to register handlers
  • Consistent reporting payloads
  • Graceful fallback and restart workflows

Highly Customizable

Shape the crash experience with custom error UI, restart behavior, and pluggable reporters instead of accepting the default app quit.

  • Override default handler logic
  • Inject user-friendly recovery screens
  • Selective restart or silent logging

Testing & Development

Built-in crash simulation utilities let you test fallback UX, release behavior, and crash reporting before users ever hit a fatal path.

  • Trigger JS exceptions on demand
  • Simulate native crashes safely
  • Verify reporting pipeline end-to-end

Production Ready

Plug into Crashlytics, Sentry, or your own analytics pipeline without rewriting the rest of your monitoring stack.

  • Attach custom metadata/context
  • Rate-limit noisy error bursts
  • Bridge docs with real monitoring workflows

TypeScript Support

Full TypeScript definitions make integrations safer and editor feedback sharper when you wire crash handling into a real app.

  • Strict handler signatures
  • Typed config options
  • Inline docs via JSDoc annotations

When to use this package

react-native-global-exception-handler fits best when you want one package to own JavaScript and native crash handling instead of stitching together separate recovery and reporting flows. It is a strong fit for apps that need release-mode crash validation, native handler chaining, and clean integrations with Sentry, Crashlytics, or a custom backend.

For AI agents and code assistants

If you are using Codex, Cursor, Claude Code, or another repo-aware assistant, start with the llms.txt entry point for the shortest machine-readable guide, then use the AI Agents page for the same task map and caveats in the docs UI.