Skip to content

Commit

Permalink
added more readme doc
Browse files Browse the repository at this point in the history
  • Loading branch information
a7ul committed Jul 26, 2018
1 parent c4785de commit f7bac35
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ import {setJSExceptionHandler, getJSExceptionHandler} from 'react-native-excepti

.
.

// For most use cases:
// registering the error handler (maybe u can do this in the index.android.js or index.ios.js)
setJSExceptionHandler((error, isFatal) => {
// This is your custom global error handler
Expand All @@ -129,6 +129,16 @@ setJSExceptionHandler((error, isFatal) => {
// or hit a custom api to inform the dev team.
});

// ADVANCED use case:
const exceptionhandler = (error, isFatal) => {
// your error handler function
};
setJSExceptionHandler(exceptionhandler, allowInDevMode);
// - exceptionhandler is the exception handler function
// - allowInDevMode is an optional parameter is a boolean.
// If set to true the handler to be called in place of RED screen
// in development mode also.

// getJSExceptionHandler gives the currently set JS exception handler
const currentHandler = getJSExceptionHandler();
```
Expand All @@ -138,6 +148,7 @@ To catch **Native_Exceptions**
```js
import {setNativeExceptionHandler} from 'react-native-exception-handler';

//For most use cases:
setNativeExceptionHandler((exceptionString) => {
// This is your custom global error handler
// You do stuff likehit google analytics to track crashes.
Expand All @@ -146,6 +157,16 @@ setNativeExceptionHandler((exceptionString) => {
//WILL NOT WORK in case of NATIVE ERRORS.
});

// ADVANCED use case:
const exceptionhandler = (exceptionString) => {
// your exception handler code here
}
setNativeExceptionHandler(exceptionhandler,forceAppQuit);
// - exceptionhandler is the exception handler function
// - forceAppQuit is an optional ANDROID specific parameter that defines
// if the app should be force quit on error. default value is true.
// To see usecase check the common issues section.

```
It is recommended you set both the handlers.

Expand Down

0 comments on commit f7bac35

Please sign in to comment.