feat:doric android and iOS's monitor add source parameter when exception

This commit is contained in:
pengfei.zhou
2020-02-22 15:37:35 +08:00
committed by osborn
parent f65b116607
commit abb1873b49
15 changed files with 139 additions and 50 deletions

View File

@@ -40,10 +40,20 @@ - (instancetype)initWithContext:(DoricContext *)context callbackId:(NSString *)c
}
- (void)resolve:(id)result {
[self.context.driver invokeDoricMethod:DORIC_BRIDGE_RESOLVE, self.context.contextId, self.callbackId, result, nil];
[[self.context.driver invokeDoricMethod:DORIC_BRIDGE_RESOLVE, self.context.contextId, self.callbackId, result, nil]
setExceptionCallback:^(NSException *e) {
[self.context.driver.registry
onException:e
source:self.context.source];
}];
}
- (void)reject:(id)result {
[self.context.driver invokeDoricMethod:DORIC_BRIDGE_REJECT, self.context.contextId, self.callbackId, result, nil];
[[self.context.driver invokeDoricMethod:DORIC_BRIDGE_REJECT, self.context.contextId, self.callbackId, result, nil]
setExceptionCallback:^(NSException *e) {
[self.context.driver.registry
onException:e
source:self.context.source];
}];
}
@end

View File

@@ -108,7 +108,7 @@ - (id)findClass:(Class)clz target:(id)target method:(NSString *)name promise:(Do
[invocation invoke];
} @catch (NSException *exception) {
DoricLog(@"CallNative Error:%@", exception.reason);
[self.doricContext.driver.registry onException:exception];
[self.doricContext.driver.registry onException:exception source:self.doricContext.source];
}
};
dispatch_async(dispatch_get_main_queue(), ^{