mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-01-30 22:48:23 +08:00
[ReactNative] Back out D2014163 entirely
This commit is contained in:
@@ -25,11 +25,17 @@ type Exception = {
|
||||
message: string;
|
||||
}
|
||||
|
||||
function reportException(e: Exception, stack?: any) {
|
||||
function handleException(e: Exception) {
|
||||
var stack = parseErrorStack(e);
|
||||
console.error(
|
||||
'Err0r: ' +
|
||||
'\n stack: \n' + stackToString(stack) +
|
||||
'\n URL: ' + e.sourceURL +
|
||||
'\n line: ' + e.line +
|
||||
'\n message: ' + e.message
|
||||
);
|
||||
|
||||
if (RCTExceptionsManager) {
|
||||
if (!stack) {
|
||||
stack = parseErrorStack(e);
|
||||
}
|
||||
RCTExceptionsManager.reportUnhandledException(e.message, stack);
|
||||
if (__DEV__) {
|
||||
(sourceMapPromise = sourceMapPromise || loadSourceMap())
|
||||
@@ -44,18 +50,6 @@ function reportException(e: Exception, stack?: any) {
|
||||
}
|
||||
}
|
||||
|
||||
function handleException(e: Exception) {
|
||||
var stack = parseErrorStack(e);
|
||||
console.log(
|
||||
'Error: ' +
|
||||
'\n stack: \n' + stackToString(stack) +
|
||||
'\n URL: ' + e.sourceURL +
|
||||
'\n line: ' + e.line +
|
||||
'\n message: ' + e.message
|
||||
);
|
||||
reportException(e, stack);
|
||||
}
|
||||
|
||||
function stackToString(stack) {
|
||||
var maxLength = Math.max.apply(null, stack.map(frame => frame.methodName.length));
|
||||
return stack.map(frame => stackFrameToString(frame, maxLength)).join('\n');
|
||||
@@ -77,4 +71,4 @@ function fillSpaces(n) {
|
||||
return new Array(n + 1).join(' ');
|
||||
}
|
||||
|
||||
module.exports = { handleException, reportException };
|
||||
module.exports = { handleException };
|
||||
|
||||
Reference in New Issue
Block a user