From d796584b6c8122ecf6fc6f0de7f82131b2ed51d1 Mon Sep 17 00:00:00 2001 From: Spencer Ahrens Date: Tue, 2 Jun 2015 17:51:36 -0700 Subject: [PATCH] [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. --- .../Initialization/InitializeJavaScriptAppEngine.js | 4 ++-- React/Modules/RCTExceptionsManager.m | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/Libraries/JavaScriptAppEngine/Initialization/InitializeJavaScriptAppEngine.js b/Libraries/JavaScriptAppEngine/Initialization/InitializeJavaScriptAppEngine.js index 29d64152e..81978ee0c 100644 --- a/Libraries/JavaScriptAppEngine/Initialization/InitializeJavaScriptAppEngine.js +++ b/Libraries/JavaScriptAppEngine/Initialization/InitializeJavaScriptAppEngine.js @@ -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() { diff --git a/React/Modules/RCTExceptionsManager.m b/React/Modules/RCTExceptionsManager.m index 7512c540d..64a5c85f0 100644 --- a/React/Modules/RCTExceptionsManager.m +++ b/React/Modules/RCTExceptionsManager.m @@ -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