feat:fix loading error cannot be thrown

This commit is contained in:
pengfei.zhou 2020-02-27 17:44:11 +08:00 committed by osborn
parent 03e5376909
commit 42ae0e245f
2 changed files with 9 additions and 1 deletions

View File

@ -59,7 +59,9 @@ public class DoricJSLoaderManager {
return jsLoader.request(source); return jsLoader.request(source);
} }
} }
return new AsyncResult<>(""); AsyncResult<String> ret = new AsyncResult<>();
ret.setError(new RuntimeException("Cannot find JS Loader for " + source));
return ret;
} }
} }

View File

@ -63,6 +63,12 @@ - (void)addJSLoader:(id <DoricLoaderProtocol>)loader {
*stop = YES; *stop = YES;
} }
}]; }];
if (!ret) {
ret = [DoricAsyncResult new];
[ret setupError:[NSException exceptionWithName:@"LoadingError"
reason:[NSString stringWithFormat:@"Cannot find JS Loader for %@", source]
userInfo:nil]];
}
return ret; return ret;
} }
@end @end