From 42ae0e245f8ad5ecbda4d04152b5da450918e17d Mon Sep 17 00:00:00 2001 From: "pengfei.zhou" Date: Thu, 27 Feb 2020 17:44:11 +0800 Subject: [PATCH] feat:fix loading error cannot be thrown --- .../main/java/pub/doric/loader/DoricJSLoaderManager.java | 4 +++- doric-iOS/Pod/Classes/Loader/DoricJSLoaderManager.m | 6 ++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/doric-android/doric/src/main/java/pub/doric/loader/DoricJSLoaderManager.java b/doric-android/doric/src/main/java/pub/doric/loader/DoricJSLoaderManager.java index 6a1d3f4c..dc220da6 100644 --- a/doric-android/doric/src/main/java/pub/doric/loader/DoricJSLoaderManager.java +++ b/doric-android/doric/src/main/java/pub/doric/loader/DoricJSLoaderManager.java @@ -59,7 +59,9 @@ public class DoricJSLoaderManager { return jsLoader.request(source); } } - return new AsyncResult<>(""); + AsyncResult ret = new AsyncResult<>(); + ret.setError(new RuntimeException("Cannot find JS Loader for " + source)); + return ret; } } diff --git a/doric-iOS/Pod/Classes/Loader/DoricJSLoaderManager.m b/doric-iOS/Pod/Classes/Loader/DoricJSLoaderManager.m index 111a81a8..016620a0 100644 --- a/doric-iOS/Pod/Classes/Loader/DoricJSLoaderManager.m +++ b/doric-iOS/Pod/Classes/Loader/DoricJSLoaderManager.m @@ -63,6 +63,12 @@ - (void)addJSLoader:(id )loader { *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; } @end