React Native Exception Handler screenshot

React Native Exception Handler

Author Avatar Theme by A7ul
Updated: 23 Mar 2021
1616 Stars

A react native module that lets you to register a global error handler that can capture fatal/non fatal uncaught exceptions.

Categories

Overview:

The react-native-exception-handler npm package is a module for React Native that enables developers to register a global error handler to capture both fatal and non-fatal uncaught exceptions. By using this module, developers can prevent their React Native apps from crashing abruptly without providing a graceful error message to users.

Features:

  • Global Error Handler: Allows for registering a global error handler to capture exceptions.
  • Prevent App Crashes: Helps in preventing unexpected app crashes by handling errors effectively.
  • Support for Unhandled Native Exceptions: Version 2 of the module supports catching unhandled native exceptions, in addition to JS exceptions.

Installation:

  1. To install using yarn:

    yarn add react-native-exception-handler
    
  2. To install using npm:

    npm i react-native-exception-handler --save
    
  3. For automatic installation, run:

    react-native link react-native-exception-handler
    
  4. For manual installation on iOS:

    • Add ReactNativeExceptionHandler.xcodeproj to your XCode project.
    • Add libReactNativeExceptionHandler.a to your project’s Build Phases.
    • Run your project.
  5. For manual installation on Android:

    • Update android/app/src/main/java/[...]/MainApplication.java.
    • Add the ReactNativeExceptionHandlerPackage() to the package list.
    • Update android/settings.gradle and android/app/build.gradle with required dependencies.

Summary:

The react-native-exception-handler npm module is a valuable tool for React Native developers to handle errors and exceptions effectively, preventing apps from crashing abruptly. By providing features like a global error handler, support for unhandled native exceptions, and detailed installation instructions, this module simplifies the process of error handling in React Native applications.