Skip to content

Commit 56aa62c

Browse files
committed
reverting for refactoring
1 parent 57fe301 commit 56aa62c

File tree

6 files changed

+7
-36
lines changed

6 files changed

+7
-36
lines changed

.DS_Store

-8 KB
Binary file not shown.

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ node_modules
33
cache
44
npm-debug.log
55
coverage
6+
.DS_Store

README.md

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# react-native-exception-handler
22

33
A react native module that lets you to register a global error handler that can capture fatal/non fatal uncaught exceptions.
4-
The module helps prevent abrupt crashing of RN Apps without a graceful message to the user.
4+
The module helps prevent abrupt crashing of RN Apps without a graceful message to the user.
55

66
In the current scenario:
77
- `In DEV mode , you get a RED Screen error pointing your JS errors.`
@@ -46,14 +46,9 @@ setJSExceptionHandler(errorHandler); // registering the error handler (maybe u c
4646
or
4747

4848
setJSExceptionHandler(errorHandler, true); //Second argument true is basically
49-
//if u need the handler to be called in place of RED
49+
//if u need the handler to be called in place of RED
5050
//screen in development mode also
51-
or
52-
53-
setJSExceptionHandler(errorHandler, true, true); //Third argument allows adding it
54-
//as a new handler, but keeping the previous one
55-
//(it will run errorHandler but still show the red screen) [Will be present in next release]
56-
```
51+
```
5752

5853

5954
### Screens

examples/bugCaptureOnError.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import {Alert} from 'react-native';
2+
import {BackAndroid} from 'react-native';
23
import {setJSExceptionHandler} from 'react-native-exception-handler';
34

45
const reporter = (error) => {

examples/seamlessCapture.js

Lines changed: 0 additions & 18 deletions
This file was deleted.

index.js

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,9 @@
11
const noop = () => {};
22

3-
export const setJSExceptionHandler = (customHandler = noop, allowedInDevMode = false, keepPreviousHandler = false) => {
3+
export const setJSExceptionHandler = (customHandler = noop, allowedInDevMode = false) => {
44
const allowed = allowedInDevMode ? true : !__DEV__;
55
if (allowed) {
6-
if (keepPreviousHandler) {
7-
const previousHandler = global.ErrorUtils.getGlobalHandler();
8-
global.ErrorUtils.setGlobalHandler((error, isFatal) => {
9-
customHandler(error, isFatal);
10-
previousHandler(error, isFatal);
11-
});
12-
} else {
13-
global.ErrorUtils.setGlobalHandler(customHandler);
14-
}
6+
global.ErrorUtils.setGlobalHandler(customHandler);
157
} else {
168
console.log('Skipping setJSExceptionHandler: Reason: In DEV mode and allowedInDevMode = false');
179
}

0 commit comments

Comments
 (0)