Skip to content

Commit 189bdd6

Browse files
committed
Properly report network error condition when importing filter list
Before this commit, a network error condition was not reported when the filter list was imported, it was only reported afterward when the imported filter list was updated.
1 parent d31e149 commit 189bdd6

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/js/assets.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -787,13 +787,17 @@ assets.get = async function(assetKey, options = {}) {
787787
contentURLs.push(...assetDetails.cdnURLs);
788788
}
789789

790+
let error = 'ENOTFOUND';
790791
for ( const contentURL of contentURLs ) {
791792
if ( reIsExternalPath.test(contentURL) && assetDetails.hasLocalURL ) {
792793
continue;
793794
}
794795
const details = assetDetails.content === 'filters'
795796
? await assets.fetchFilterList(contentURL)
796797
: await assets.fetchText(contentURL);
798+
if ( details.error !== undefined ) {
799+
error = details.error;
800+
}
797801
if ( details.content === '' ) { continue; }
798802
if ( reIsExternalPath.test(contentURL) && options.dontCache !== true ) {
799803
assetCacheWrite(assetKey, {
@@ -804,7 +808,12 @@ assets.get = async function(assetKey, options = {}) {
804808
}
805809
return reportBack(details.content, contentURL);
806810
}
807-
return reportBack('', '', 'ENOTFOUND');
811+
if ( assetRegistry[assetKey] !== undefined ) {
812+
registerAssetSource(assetKey, {
813+
error: { time: Date.now(), error }
814+
});
815+
}
816+
return reportBack('', '', error);
808817
};
809818

810819
/******************************************************************************/

0 commit comments

Comments
 (0)