How to use the react-native-exception-handler.setJSExceptionHandler function in react-native-exception-handler

To help you get started, we’ve selected a few react-native-exception-handler examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github berty / berty / client / react-native / app / common / helpers / crash-handler.js View on Github external
{ cancelable: false }
  )
}

if (!isIntegrationMode) {
  // eslint-disable-next-line
  if (!__DEV__) {
    console.error = error => exceptionHandler(error, false)
  }

  if (Platform.OS === 'ios' || Platform.OS === 'android') {
    const allowInDevMode = false
    const forceAppQuit = false
    const executeDefaultHandler = false

    setJSExceptionHandler(exceptionHandler, allowInDevMode)
    setNativeExceptionHandler(() => {}, forceAppQuit, executeDefaultHandler)
  }
}
github HenryQuan / WoWs-Info-Re / WoWsInfo / src / app.js View on Github external
import { withTheme, DarkTheme, DefaultTheme } from 'react-native-paper';
import { Menu, Settings, About, Setup, Consumable, CommanderSkill, 
  BasicDetail, Achievement, Map as GameMap, Collection, Warship, WarshipDetail, 
  WarshipFilter, WarshipModule, Loading, Statistics, ClanInfo, PlayerAchievement, 
  Rating, Search, Graph, SimilarGraph, License, RS, SupportMe, ProVersion } from './page';
import { LOCAL, getFirstLaunch, getCurrServer, APP } from './value/data';
import { DataLoader, Downloader } from './core';
import { GREY, BLUE } from 'react-native-material-color';
import { TintColour } from './value/colour';
import { lang } from './value/lang';
import { PlayerShip } from './page/player/PlayerShip';
import { Detailed } from './page/player/Detailed';
import { Rank } from './page/player/Rank';
import { setJSExceptionHandler, setNativeExceptionHandler } from 'react-native-exception-handler';

setJSExceptionHandler((e, fatal) => {
  if (fatal) {
    showAlert(`${e.name}\n${e.message}`, 'JS');
  } else {
    console.log(`JSException\n${e}`);
  }
}, true);

setNativeExceptionHandler((e) => {
  showAlert(e, 'NATIVE');
  console.log(`NativeException\n${e}`);
});

// Ask user to email me the log
function showAlert(msg, mode) {
  Alert.alert(`FATAL ${mode} ERROR`, `${msg}\n\nPlease contact developer`,
    [{
github berty / berty / client / react-native / common / helpers / crash-handler.js View on Github external
{ cancelable: false }
  )
}

if (process.env['ENVIRONMENT'] !== 'integration_test') {
  // eslint-disable-next-line
  if (!__DEV__) {
    console.error = error => exceptionHandler(error, false)
  }

  if (Platform.OS === 'ios' || Platform.OS === 'android') {
    const allowInDevMode = false
    const forceAppQuit = false
    const executeDefaultHandler = false

    setJSExceptionHandler(exceptionHandler, allowInDevMode)
    setNativeExceptionHandler(() => {}, forceAppQuit, executeDefaultHandler)
  }
}
github berty / berty / client / packages / common / helpers / crash-handler.js View on Github external
!isFatal && { text: I18n.t('cancel') },
    ],
    { cancelable: false }
  )
}

if (!isIntegrationMode && Platform.OS !== 'web') {
  if (!__DEV__) {
    console.error = error => exceptionHandler(error, false)
  }

  const allowInDevMode = false
  const forceAppQuit = false
  const executeDefaultHandler = true

  setJSExceptionHandler(exceptionHandler, allowInDevMode)
  setNativeExceptionHandler(
    () =>
      Notifier.system({
        title: I18n.t('restart'),
        body: I18n.t('unexpected-error'),
      }),
    forceAppQuit,
    executeDefaultHandler
  )
}
github lbryio / lbry-android / app / src / index.js View on Github external
import { persistStore, autoRehydrate } from 'redux-persist';
import AsyncStorage from '@react-native-community/async-storage';
import FilesystemStorage from 'redux-persist-filesystem-storage';
import createCompressor from 'redux-persist-transform-compress';
import createFilter from 'redux-persist-transform-filter';
import moment from 'moment';
import drawerReducer from 'redux/reducers/drawer';
import settingsReducer from 'redux/reducers/settings';
import thunk from 'redux-thunk';

const globalExceptionHandler = (error, isFatal) => {
  if (error && NativeModules.Firebase) {
    NativeModules.Firebase.logException(isFatal, error.message ? error.message : 'No message', JSON.stringify(error));
  }
};
setJSExceptionHandler(globalExceptionHandler, true);

function isFunction(object) {
  return typeof object === 'function';
}

function isNotFunction(object) {
  return !isFunction(object);
}

function createBulkThunkMiddleware() {
  return ({ dispatch, getState }) => next => action => {
    if (action.type === 'BATCH_ACTIONS') {
      action.actions.filter(isFunction).map(actionFn => actionFn(dispatch, getState));
    }
    return next(action);
  };
github UCSD / campus-mobile / app / App.js View on Github external
finishLoading = () => {
		this.setState({ isLoading: false })
		const errorHandler = (e, isFatal) => {
			if (isFatal) {
				gracefulFatalReset(new Error('Crash: ' + e.name + ': ' + e.message + ': ' + e.stack))
			}
		}
		setJSExceptionHandler(errorHandler, true)
	}
github mattermost / mattermost-mobile / app / utils / error_handling.js View on Github external
initializeErrorHandling = (store) => {
        this.store = store;
        initializeSentry();
        setJSExceptionHandler(this.errorHandler, false);
        setNativeExceptionHandler(this.nativeErrorHandler, false);
    }
github UCSD / campus-mobile / app / configureStore.js View on Github external
const finishLoading = () => {
	const errorHandler = (e, isFatal) => {
		if (isFatal) {
			gracefulFatalReset(new Error('Crash: ' + e.name + ': ' + e.message + ': ' + e.stack))
		}
	}
	setJSExceptionHandler(errorHandler, true)
}
github berty / berty / js / packages / components / error.tsx View on Github external
React.useEffect(() => {
		setJSExceptionHandler(errorHandler)
		setNativeExceptionHandler(errorHandler)
	}, [])
github RN-ONE / RNFrameWorkNew / app / IndexApp.js View on Github external
constructor(props) {
        super(props);
    }

    componentDidMount() {
    }

    render() {
        return (
            
        )
    }
}


setJSExceptionHandler(errorHandler);

export default IndexApp;

react-native-exception-handler

A react native module that lets you to register a global error handler that can capture fatal/non fatal uncaught exceptions.

MIT
Latest version published 4 years ago

Package Health Score

51 / 100
Full package analysis