3.0.2 • Published 9 months ago

react-native-exc v3.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
9 months ago

react-native-exc

New React Native program error management library

Inspired by: react-native-exception-handler

Installation

npm install react-native-exc

or

yarn add react-native-exc

Auto-Linking Setup (react-native >= 0.60)

iOS

$ cd ios
$ pod install

Android

No further steps should be taken

Usage example

import { setJSExceptionHandler, setNativeExceptionHandler } from 'react-native-exc';
const errorHandler = (e: any, isFatal: any) => {
  if (isFatal) {
    Alert.alert(
      'Unexpected error occurred',
      `
        Error: ${isFatal ? 'Fatal:' : ''} ${e.name} ${e.message}

        We will need to restart the app.
        `,
      [
        {
          text: 'Restart',
          onPress: () => {
            console.log('restart');
          },
        },
      ]
    );
  } else {
    console.log(e); // So that we can see it in the ADB logs in case of Android if needed
  }
};

setJSExceptionHandler(errorHandler);

//...

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

License

MIT


MRB

3.0.2

9 months ago

3.0.1

9 months ago

3.0.0

9 months ago

0.1.0

9 months ago