Skip to content

Commit

Permalink
Show redbox window on JS errors for debug builds
Browse files Browse the repository at this point in the history
Reviewed By: javache

Differential Revision: D4860613

fbshipit-source-id: 255202df9401ffd1dfb48224dd89255eac76874e
  • Loading branch information
fromcelticpark authored and facebook-github-bot committed Apr 11, 2017
1 parent cb88df0 commit abd148f
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions React/Modules/RCTRedBox.m
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,9 @@ - (RCTErrorInfo *)_customizeError:(RCTErrorInfo *)error

- (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
Expand All @@ -378,11 +380,15 @@ - (void)showErrorMessage:(NSString *)message

- (void)showErrorMessage:(NSString *)message withDetails:(NSString *)details
{
[self showErrorMessage:message withDetails:details stack:nil];
}

- (void)showErrorMessage:(NSString *)message withDetails:(NSString *)details stack:(NSArray<id> *)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
Expand Down

0 comments on commit abd148f

Please sign in to comment.