iOS:set js exception to nil before throw NSException

This commit is contained in:
pengfei.zhou 2020-03-09 11:02:15 +08:00 committed by osborn
parent 06c888634c
commit 2f93bd6533

View File

@ -39,6 +39,7 @@ - (instancetype)init {
- (void)checkJSException { - (void)checkJSException {
if (self.jsContext.exception) { if (self.jsContext.exception) {
NSString *errMsg = [NSString stringWithFormat:@"%@ (line %@ in the generated bundle)\n/***StackTrace***/\n%@\n/***StackTrace***/", self.jsContext.exception, self.jsContext.exception[@"line"], self.jsContext.exception[@"stack"]]; NSString *errMsg = [NSString stringWithFormat:@"%@ (line %@ in the generated bundle)\n/***StackTrace***/\n%@\n/***StackTrace***/", self.jsContext.exception, self.jsContext.exception[@"line"], self.jsContext.exception[@"stack"]];
self.jsContext.exception = nil;
@throw [[NSException alloc] initWithName:@"DoricJS" reason:errMsg userInfo:nil]; @throw [[NSException alloc] initWithName:@"DoricJS" reason:errMsg userInfo:nil];
} }
} }