Remove capture errors

This commit is contained in:
Yousef Hamza 2017-05-08 10:45:45 +02:00
parent f4edf879a2
commit cabacb6222
3 changed files with 0 additions and 76 deletions

View File

@ -6,7 +6,6 @@
import {NativeModules, NativeAppEventEmitter, Platform} from 'react-native';
let {Instabug} = NativeModules;
import instabugUtils from './utils/instabugUtils.js';
/**
* Instabug
@ -475,34 +474,6 @@ module.exports = {
Instabug.isInstabugNotification(dict, isInstabugNotificationCallback);
},
/**
* Report a caught exception to Instabug dashboard
*
* @param error the error to be reported
* @param errorIdentifier used to group issues manually reported
* @throws Error if error param type wasn't Error
*/
reportJsException: function (error, errorIdentifier) {
if (!error || !error instanceof Error)
throw new TypeError("Invalid param type at param1, Expected Error");
let jsStackTrace = instabugUtils.parseErrorStack(error);
if (!errorIdentifier)
Instabug.reportJsException(jsStackTrace, error.message, null);
else if (errorIdentifier) {
Instabug.reportJsException(jsStackTrace, error.message, errorIdentifier);
}
},
/**
* Report un-caught exceptions to Instabug dashboard
* We don't send exceptions from __DEV__, since it's way too noisy!
*/
captureJsErrors(){
if (Platform.OS === 'android')
instabugUtils.captureJsErrors();
},
/**
* Add file to attached files with each report being sent.
* A new copy of the file at fileURL will be attached with each bug report being sent. The file is only copied

View File

@ -3,9 +3,6 @@
"version": "1.0.7",
"description": "React Native plugin for integrating the Instabug SDK",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "git+https://github.com/Instabug/instabug-reactnative.git"
@ -28,8 +25,5 @@
"android": {
"packageInstance": "new RNInstabugReactnativePackage(MainApplication.this)"
}
},
"dependencies": {
"stacktrace-parser": "0.1.3"
}
}

View File

@ -1,41 +0,0 @@
'use strict';
import {NativeModules, Platform} from 'react-native';
let {Instabug} = NativeModules;
let stacktraceParser = require('stacktrace-parser');
let parseErrorStack = (error) => {
if (!error || !error.stack) {
return [];
}
return Array.isArray(error.stack) ? error.stack :
stacktraceParser.parse(error.stack);
};
let init = () => {
if (__DEV__) {
return;
}
const originalHandler = global.ErrorUtils.getGlobalHandler();
function errorHandler(e, isFatal) {
let jsStackTrace = parseErrorStack(error);
Instabug.reportJsException(jsStackTrace, e.message, "unhandled");
if (originalHandler) {
if (Platform.OS === 'ios') {
originalHandler(e, isFatal);
} else {
setTimeout(() => {
originalHandler(e, isFatal);
}, 500);
}
}
}
global.ErrorUtils.setGlobalHandler(errorHandler);
};
module.exports = {
parseErrorStack: parseErrorStack,
captureJsErrors: init
};