Skip to content

Commit 163f3bc

Browse files
authored
Revert "v 2.4.1 with Gustavo's fix (#20)" (#21)
This reverts commit b17c282.
1 parent b17c282 commit 163f3bc

File tree

4 files changed

+7
-39
lines changed

4 files changed

+7
-39
lines changed

README.md

+1-20
Original file line numberDiff line numberDiff line change
@@ -381,33 +381,14 @@ setNativeExceptionHandler((errorString) => {
381381
*More Examples can be found in the examples folder*
382382
- Preserving old handler (thanks to zeh)
383383

384-
# Known issues and fixes:
385-
386-
### react-native-navigation (Wix)
387-
388-
This is specifically occuring when you use [wix library](http://wix.github.io/react-native-navigation/) for navigation along with react-native-exception-handler. Whenever an error occurs, it will recreate the application above the crash screen.
389-
390-
391-
**Fix:**
392-
393-
You need to set second parametera as *false* while calling _setNativeExceptionHandler_.
394-
The second parameter is an android specific field which stands for forceQuitOnError.
395-
When set to false it doesnt quit the app forcefully on error. In short :
396-
397-
Credit goes to **Gustavo Fão Valvassori**
398-
399-
```js
400-
setNativeExceptionHandler(nativeErrorCallback, false);
401-
```
402-
403384

404385
## CONTRIBUTORS
405386
- [Atul R](https://github.com/master-atul)
406387
- [Zeh Fernando](https://github.com/zeh)
407388
- [Fred Chasen](https://github.com/fchasen)
408389
- [Christoph Jerolimov](https://github.com/jerolimov)
409390
- [Peter Chow](https://github.com/peteroid)
410-
- [Gustavo Fão Valvassori](https://github.com/faogustavo)
391+
411392
## TESTING NATIVE EXCEPTIONS/ERRORS
412393

413394
To make sure this module works. You can generate a native exception using the module `rn-test-exception-handler`.

android/src/main/java/com/masteratul/exceptionhandler/ReactNativeExceptionHandlerModule.java

+2-10
Original file line numberDiff line numberDiff line change
@@ -28,29 +28,21 @@ public String getName() {
2828

2929

3030
@ReactMethod
31-
public void setHandlerforNativeException(Callback customHandler, final boolean forceToQuit){
31+
public void setHandlerforNativeException(Callback customHandler){
3232
callbackHolder = customHandler;
33-
3433
Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {
3534
@Override
3635
public void uncaughtException(Thread thread, Throwable throwable) {
3736
activity = getCurrentActivity();
3837
String stackTraceString = Log.getStackTraceString(throwable);
3938
callbackHolder.invoke(stackTraceString);
4039
Log.d("ERROR",stackTraceString);
41-
42-
4340
Intent i = new Intent();
4441
i.setClass(activity, errorIntentTargetClass);
4542
i.putExtra("stack_trace_string",stackTraceString);
4643
i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
47-
4844
activity.startActivity(i);
49-
activity.finish();
50-
51-
if (forceToQuit) {
52-
System.exit(0);
53-
}
45+
System.exit(0);
5446
}
5547
});
5648
}

index.js

+3-8
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
import {NativeModules, Platform} from 'react-native';
2+
import {NativeModules} from 'react-native';
33

44
const {ReactNativeExceptionHandler} = NativeModules;
55

@@ -17,16 +17,11 @@ export const setJSExceptionHandler = (customHandler = noop, allowedInDevMode = f
1717

1818
export const getJSExceptionHandler = () => global.ErrorUtils.getGlobalHandler();
1919

20-
export const setNativeExceptionHandler = (customErrorHandler = noop, forceApplicationToQuit = true) => {
20+
export const setNativeExceptionHandler = (customErrorHandler = noop) => {
2121
if (typeof customErrorHandler !== 'function') {
2222
customErrorHandler = noop;
2323
}
24-
25-
if (Platform.OS === 'ios') {
26-
ReactNativeExceptionHandler.setHandlerforNativeException(customErrorHandler);
27-
} else {
28-
ReactNativeExceptionHandler.setHandlerforNativeException(customErrorHandler, forceApplicationToQuit);
29-
}
24+
ReactNativeExceptionHandler.setHandlerforNativeException(customErrorHandler);
3025
};
3126

3227
export default {

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-native-exception-handler",
3-
"version": "2.4.1",
3+
"version": "2.4.0",
44
"description": "A react native module that lets you to register a global error handler that can capture fatal/non fatal uncaught exceptions.",
55
"main": "index.js",
66
"scripts": {

0 commit comments

Comments
 (0)