@@ -120,7 +120,7 @@ import {setJSExceptionHandler, getJSExceptionHandler} from 'react-native-excepti
120120
121121.
122122.
123-
123+ // For most use cases:
124124// registering the error handler (maybe u can do this in the index.android.js or index.ios.js)
125125setJSExceptionHandler ((error , isFatal ) => {
126126 // This is your custom global error handler
@@ -129,6 +129,16 @@ setJSExceptionHandler((error, isFatal) => {
129129 // or hit a custom api to inform the dev team.
130130});
131131
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+
132142// getJSExceptionHandler gives the currently set JS exception handler
133143const currentHandler = getJSExceptionHandler ();
134144```
@@ -138,6 +148,7 @@ To catch **Native_Exceptions**
138148``` js
139149import {setNativeExceptionHandler } from ' react-native-exception-handler' ;
140150
151+ // For most use cases:
141152setNativeExceptionHandler ((exceptionString ) => {
142153 // This is your custom global error handler
143154 // You do stuff likehit google analytics to track crashes.
@@ -146,6 +157,16 @@ setNativeExceptionHandler((exceptionString) => {
146157 // WILL NOT WORK in case of NATIVE ERRORS.
147158});
148159
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+
149170```
150171It is recommended you set both the handlers.
151172
0 commit comments