add exception handle

This commit is contained in:
王劲鹏 2022-01-10 12:04:05 +08:00 committed by osborn
parent 141b02b142
commit 65105eabfc

View File

@ -33,6 +33,9 @@ - (void)getImageInfo:(NSDictionary *)resource withPromise:(DoricPromise *)promis
@"height": @(image.size.height)
}];
}];
[asyncResult setExceptionCallback:^(NSException * _Nonnull e) {
DoricLog(@"Cannot load resource %s, %s", resource.description, e.description);
}];
} else {
DoricLog(@"Cannot find loader for resource %s", resource.description);
[promise reject:@"Load error"];
@ -66,6 +69,9 @@ - (void)decodeToPixels:(NSDictionary *)resource withPromise:(DoricPromise *)prom
[promise resolve:data];
}];
[asyncResult setExceptionCallback:^(NSException * _Nonnull e) {
DoricLog(@"Cannot load resource %s, %s", resource.description, e.description);
}];
} else {
DoricLog(@"Cannot find loader for resource %s", resource.description);
[promise reject:@"Load error"];