Show redbox window on JS errors for debug builds

Reviewed By: javache

Differential Revision: D4860613

fbshipit-source-id: 255202df9401ffd1dfb48224dd89255eac76874e
This commit is contained in:
Alex Dvornikov 2017-04-11 05:54:15 -07:00 committed by Facebook Github Bot
parent cb88df00ae
commit abd148fa21
1 changed files with 8 additions and 2 deletions

View File

@ -368,7 +368,9 @@ RCT_EXPORT_MODULE()
- (void)showError:(NSError *)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 - (void)showErrorMessage:(NSString *)message
@ -378,11 +380,15 @@ RCT_EXPORT_MODULE()
- (void)showErrorMessage:(NSString *)message withDetails:(NSString *)details - (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; NSString *combinedMessage = message;
if (details) { if (details) {
combinedMessage = [NSString stringWithFormat:@"%@\n\n%@", message, 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 - (void)showErrorMessage:(NSString *)message withRawStack:(NSString *)rawStack