From abd148fa21902c76c37d521481391a4bd9a13e46 Mon Sep 17 00:00:00 2001 From: Alex Dvornikov Date: Tue, 11 Apr 2017 05:54:15 -0700 Subject: [PATCH] Show redbox window on JS errors for debug builds Reviewed By: javache Differential Revision: D4860613 fbshipit-source-id: 255202df9401ffd1dfb48224dd89255eac76874e --- React/Modules/RCTRedBox.m | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/React/Modules/RCTRedBox.m b/React/Modules/RCTRedBox.m index c8003bc6d..dbcea6513 100644 --- a/React/Modules/RCTRedBox.m +++ b/React/Modules/RCTRedBox.m @@ -368,7 +368,9 @@ RCT_EXPORT_MODULE() - (void)showError:(NSError *)error { - [self showErrorMessage:error.localizedDescription withDetails:error.localizedFailureReason]; + [self showErrorMessage:error.localizedDescription + withDetails:error.localizedFailureReason + stack:error.userInfo[RCTJSStackTraceKey]]; } - (void)showErrorMessage:(NSString *)message @@ -378,11 +380,15 @@ RCT_EXPORT_MODULE() - (void)showErrorMessage:(NSString *)message withDetails:(NSString *)details { + [self showErrorMessage:message withDetails:details stack:nil]; +} + +- (void)showErrorMessage:(NSString *)message withDetails:(NSString *)details stack:(NSArray *)stack { NSString *combinedMessage = message; if (details) { combinedMessage = [NSString stringWithFormat:@"%@\n\n%@", message, details]; } - [self showErrorMessage:combinedMessage withStack:nil isUpdate:NO]; + [self showErrorMessage:combinedMessage withStack:stack isUpdate:NO]; } - (void)showErrorMessage:(NSString *)message withRawStack:(NSString *)rawStack