Display JS exceptions and stacks in a red box.

Reviewed By: javache

Differential Revision: D3429031

fbshipit-source-id: a7ffd71151d8d78ccf8f0cc45807762b601cd112
This commit is contained in:
Marc Horowitz 2016-06-30 19:38:53 -07:00 committed by Facebook Github Bot
parent 2b88482701
commit d1d9045eb4
4 changed files with 14 additions and 0 deletions

View File

@ -55,6 +55,11 @@ RCT_EXTERN NSString *const RCTErrorDomain;
*/
RCT_EXTERN NSString *const RCTJSStackTraceKey;
/**
* Raw JS Stack trace string provided as part of an NSError's userInfo
*/
RCT_EXTERN NSString *const RCTJSRawStackTraceKey;
/**
* Name of fatal exceptions generated by RCTFatal
*/

View File

@ -12,6 +12,7 @@
NSString *const RCTErrorDomain = @"RCTErrorDomain";
NSString *const RCTJSStackTraceKey = @"RCTJSStackTraceKey";
NSString *const RCTJSRawStackTraceKey = @"RCTJSRawStackTraceKey";
NSString *const RCTFatalExceptionName = @"RCTFatalException";
static NSString *const RCTAssertFunctionStack = @"RCTAssertFunctionStack";

View File

@ -17,6 +17,7 @@
- (void)showError:(NSError *)error;
- (void)showErrorMessage:(NSString *)message;
- (void)showErrorMessage:(NSString *)message withDetails:(NSString *)details;
- (void)showErrorMessage:(NSString *)message withRawStack:(NSString *)rawStack;
- (void)showErrorMessage:(NSString *)message withStack:(NSArray<NSDictionary *> *)stack;
- (void)updateErrorMessage:(NSString *)message withStack:(NSArray<NSDictionary *> *)stack;

View File

@ -339,6 +339,13 @@ RCT_EXPORT_MODULE()
[self showErrorMessage:combinedMessage];
}
- (void)showErrorMessage:(NSString *)message withRawStack:(NSString *)rawStack
{
// TODO #11638796: convert rawStack into something useful
message = [NSString stringWithFormat:@"%@\n\n%@", message, rawStack];
[self showErrorMessage:message withStack:nil isUpdate:NO];
}
- (void)showErrorMessage:(NSString *)message withStack:(NSArray<NSDictionary *> *)stack
{
[self showErrorMessage:message withStack:stack isUpdate:NO];