@@ -120,7 +120,7 @@ import {setJSExceptionHandler, getJSExceptionHandler} from 'react-native-excepti
120
120
121
121
.
122
122
.
123
-
123
+ // For most use cases:
124
124
// registering the error handler (maybe u can do this in the index.android.js or index.ios.js)
125
125
setJSExceptionHandler ((error , isFatal ) => {
126
126
// This is your custom global error handler
@@ -129,6 +129,16 @@ setJSExceptionHandler((error, isFatal) => {
129
129
// or hit a custom api to inform the dev team.
130
130
});
131
131
132
+ // ADVANCED use case:
133
+ const exceptionhandler = (error , isFatal ) => {
134
+ // your error handler function
135
+ };
136
+ setJSExceptionHandler (exceptionhandler, allowInDevMode);
137
+ // - exceptionhandler is the exception handler function
138
+ // - allowInDevMode is an optional parameter is a boolean.
139
+ // If set to true the handler to be called in place of RED screen
140
+ // in development mode also.
141
+
132
142
// getJSExceptionHandler gives the currently set JS exception handler
133
143
const currentHandler = getJSExceptionHandler ();
134
144
```
@@ -138,6 +148,7 @@ To catch **Native_Exceptions**
138
148
``` js
139
149
import {setNativeExceptionHandler } from ' react-native-exception-handler' ;
140
150
151
+ // For most use cases:
141
152
setNativeExceptionHandler ((exceptionString ) => {
142
153
// This is your custom global error handler
143
154
// You do stuff likehit google analytics to track crashes.
@@ -146,6 +157,16 @@ setNativeExceptionHandler((exceptionString) => {
146
157
// WILL NOT WORK in case of NATIVE ERRORS.
147
158
});
148
159
160
+ // ADVANCED use case:
161
+ const exceptionhandler = (exceptionString ) => {
162
+ // your exception handler code here
163
+ }
164
+ setNativeExceptionHandler (exceptionhandler,forceAppQuit);
165
+ // - exceptionhandler is the exception handler function
166
+ // - forceAppQuit is an optional ANDROID specific parameter that defines
167
+ // if the app should be force quit on error. default value is true.
168
+ // To see usecase check the common issues section.
169
+
149
170
```
150
171
It is recommended you set both the handlers.
151
172
0 commit comments