mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-03-26 23:24:06 +08:00
[ReactNative] ErrorUtils.reportError shouldn't redbox
Summary:
@public
ErrorUtils.reportError is intended for reporting handled errors to the
server, like timeouts, which means that we shouldn't shove them in the
developer's face.
Test Plan: add `require('ErrorUtils').reportError(new Error('error'))` and see a useful error message with stack but no redbox. Debugger confirms `reportSoftException` is called but it doesn't do anything yet. `reportFatalError` and throwing exceptions still show redboxes.
This commit is contained in:
@@ -33,7 +33,7 @@ if (typeof window === 'undefined') {
|
||||
window = GLOBAL;
|
||||
}
|
||||
|
||||
function handleErrorWithRedBox(e, isFatal) {
|
||||
function handleError(e, isFatal) {
|
||||
try {
|
||||
require('ExceptionsManager').handleException(e, isFatal);
|
||||
} catch(ee) {
|
||||
@@ -43,7 +43,7 @@ function handleErrorWithRedBox(e, isFatal) {
|
||||
|
||||
function setUpRedBoxErrorHandler() {
|
||||
var ErrorUtils = require('ErrorUtils');
|
||||
ErrorUtils.setGlobalHandler(handleErrorWithRedBox);
|
||||
ErrorUtils.setGlobalHandler(handleError);
|
||||
}
|
||||
|
||||
function setUpRedBoxConsoleErrorHandler() {
|
||||
|
||||
@@ -44,8 +44,7 @@ RCT_EXPORT_METHOD(reportSoftException:(NSString *)message
|
||||
[_delegate handleSoftJSExceptionWithMessage:message stack:stack];
|
||||
return;
|
||||
}
|
||||
|
||||
[[RCTRedBox sharedInstance] showErrorMessage:message withStack:stack];
|
||||
// JS already logs the error via console.
|
||||
}
|
||||
|
||||
RCT_EXPORT_METHOD(reportFatalException:(NSString *)message
|
||||
|
||||
Reference in New Issue
Block a user