Add exception description to exception name

Reviewed By: fkgozali

Differential Revision: D2687906

fb-gh-sync-id: f1bbc7c3deb9068877add37619faee730cdec743
This commit is contained in:
Pieter De Baets 2015-11-23 14:47:36 -08:00 committed by facebook-github-bot-4
parent e49c70026a
commit b40631d0db
2 changed files with 4 additions and 3 deletions

View File

@ -128,8 +128,9 @@ void RCTFatal(NSError *error)
#if DEBUG
@try {
#endif
NSString *name = [NSString stringWithFormat:@"%@: %@", RCTFatalExceptionName, [error localizedDescription]];
NSString *message = RCTFormatError([error localizedDescription], error.userInfo[RCTJSStackTraceKey], 75);
[NSException raise:RCTFatalExceptionName format:@"%@", message];
[NSException raise:name format:@"%@", message];
#if DEBUG
} @catch (NSException *e) {}
#endif
@ -160,5 +161,5 @@ NSString *RCTFormatError(NSString *message, NSArray<NSDictionary<NSString *, id>
}
}
return [NSString stringWithFormat:@"Message: %@%@", message, prettyStack];
return [NSString stringWithFormat:@"%@%@", message, prettyStack];
}

View File

@ -780,7 +780,7 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithBundleURL:(__unused NSURL *)bundleUR
}
@catch (NSException *exception) {
// Pass on JS exceptions
if ([exception.name isEqualToString:RCTFatalExceptionName]) {
if ([exception.name hasPrefix:RCTFatalExceptionName]) {
@throw exception;
}