Skip to main content

Catch native & JS crashes
Show a graceful fallback
Ship resilient apps

Global exception handling for React Native 0.68+: TurboModules, native crash interception, simulation, and TypeScript‑first APIs.

yarn add react-native-global-exception-handleryarn add 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
});

See It In Action

Watch how the library handles crashes gracefully on both iOS and Android

iOS Demo

Test native crash handling with built-in simulation tools for comprehensive error testing

Android Demo

Default error screen displays crash details with options to relaunch the app or quit gracefully

Why Global Exception Handler?

Catch crashes across JavaScript and native layers, customize recovery UI, and ship more resilient apps. Explore the core advantages below.

Modern Architecture

Built with TurboModules for React Native 0.68+. Modern link to native functionality with minimal bridge overhead.

  • Zero-config install for supported RN versions
  • Lean native surface → faster startup
  • Future‑proof architecture alignment

Dual Exception Handling

Catches both JavaScript and native exceptions with one unified API surface.

  • Single place to register handlers
  • Consistent reporting payloads
  • Graceful fallback UI trigger

Highly Customizable

Configurable options with custom error UI, restart behavior, and pluggable reporters.

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

Testing & Development

Built-in crash simulation utilities to validate your fallback UX before shipping.

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

Production Ready

Integrate with Crashlytics, Sentry, or any analytics service using flexible hooks.

  • Attach custom metadata/context
  • Rate-limit noisy error bursts
  • Works offline with queued dispatch

TypeScript Support

Full TypeScript definitions for safer integrations and better editor guidance.

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