[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:
Spencer Ahrens
2015-06-02 17:51:36 -07:00
parent d90999a989
commit d796584b6c
2 changed files with 3 additions and 4 deletions

View File

@@ -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() {

View File

@@ -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