# react-native-exc

> Exception Handler

Latest version **3.0.2** (published 2023-08-24) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-native-exc
pnpm add react-native-exc
yarn add react-native-exc
bun add react-native-exc
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 3.0.2 |
| Published | 2023-08-24 |
| First published | 2023-08-23 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >= 16.0.0 |
| Dependencies | 0 |
| Unpacked size | 51 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 6 |
| Author | MehrabSp |
| Maintainers | mehrabsp |
| Keywords | react-native, ios, android |

## Links

- npm: https://www.npmjs.com/package/react-native-exc
- Repository: https://github.com/MehrabSp/react-native-exc
- Homepage: https://github.com/MehrabSp/react-native-exc#readme
- Issues: https://github.com/MehrabSp/react-native-exc/issues
- npm.io page: https://npm.io/package/react-native-exc

## Alternatives

- [@sindresorhus/slugify](https://npm.io/package/@sindresorhus/slugify.md) — 3.7M weekly downloads
- [solid-js](https://npm.io/package/solid-js.md) — 2.7M weekly downloads
- [expo-glass-effect](https://npm.io/package/expo-glass-effect.md) — 2.5M weekly downloads
- [nanoassert](https://npm.io/package/nanoassert.md) — 780.8K weekly downloads
- [@ffmpeg/ffmpeg](https://npm.io/package/@ffmpeg/ffmpeg.md) — 529.5K weekly downloads

## Recent versions

- 3.0.2 (latest) — 2023-08-24
- 3.0.1 — 2023-08-23
- 3.0.0 — 2023-08-23
- 0.1.0 — 2023-08-23

## README

# react-native-exc

New React Native program error management library

Inspired by: 
[react-native-exception-handler](https://github.com/a7ul/react-native-exception-handler)

## Installation

```sh
npm install react-native-exc
```
or
```sh
yarn add react-native-exc
```

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

### iOS

```bash
$ cd ios
$ pod install
```

### Android

No further steps should be taken

## Usage example

```js
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](CONTRIBUTING.md) to learn how to contribute to the repository and the development workflow.

## License

MIT

---

MRB

---
_Source: https://npm.io/package/react-native-exc · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
