mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-29 04:35:36 +08:00
Add exception description to exception name
Reviewed By: fkgozali Differential Revision: D2687906 fb-gh-sync-id: f1bbc7c3deb9068877add37619faee730cdec743
This commit is contained in:
committed by
facebook-github-bot-4
parent
e49c70026a
commit
b40631d0db
@@ -128,8 +128,9 @@ void RCTFatal(NSError *error)
|
|||||||
#if DEBUG
|
#if DEBUG
|
||||||
@try {
|
@try {
|
||||||
#endif
|
#endif
|
||||||
|
NSString *name = [NSString stringWithFormat:@"%@: %@", RCTFatalExceptionName, [error localizedDescription]];
|
||||||
NSString *message = RCTFormatError([error localizedDescription], error.userInfo[RCTJSStackTraceKey], 75);
|
NSString *message = RCTFormatError([error localizedDescription], error.userInfo[RCTJSStackTraceKey], 75);
|
||||||
[NSException raise:RCTFatalExceptionName format:@"%@", message];
|
[NSException raise:name format:@"%@", message];
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
} @catch (NSException *e) {}
|
} @catch (NSException *e) {}
|
||||||
#endif
|
#endif
|
||||||
@@ -160,5 +161,5 @@ NSString *RCTFormatError(NSString *message, NSArray<NSDictionary<NSString *, id>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return [NSString stringWithFormat:@"Message: %@%@", message, prettyStack];
|
return [NSString stringWithFormat:@"%@%@", message, prettyStack];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -780,7 +780,7 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithBundleURL:(__unused NSURL *)bundleUR
|
|||||||
}
|
}
|
||||||
@catch (NSException *exception) {
|
@catch (NSException *exception) {
|
||||||
// Pass on JS exceptions
|
// Pass on JS exceptions
|
||||||
if ([exception.name isEqualToString:RCTFatalExceptionName]) {
|
if ([exception.name hasPrefix:RCTFatalExceptionName]) {
|
||||||
@throw exception;
|
@throw exception;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user