mirror of https://github.com/gorhill/uBlock.git
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.
This commit is contained in:
parent
d31e14995e
commit
189bdd685f
|
@ -787,6 +787,7 @@ assets.get = async function(assetKey, options = {}) {
|
|||
contentURLs.push(...assetDetails.cdnURLs);
|
||||
}
|
||||
|
||||
let error = 'ENOTFOUND';
|
||||
for ( const contentURL of contentURLs ) {
|
||||
if ( reIsExternalPath.test(contentURL) && assetDetails.hasLocalURL ) {
|
||||
continue;
|
||||
|
@ -794,6 +795,9 @@ assets.get = async function(assetKey, options = {}) {
|
|||
const details = assetDetails.content === 'filters'
|
||||
? await assets.fetchFilterList(contentURL)
|
||||
: await assets.fetchText(contentURL);
|
||||
if ( details.error !== undefined ) {
|
||||
error = details.error;
|
||||
}
|
||||
if ( details.content === '' ) { continue; }
|
||||
if ( reIsExternalPath.test(contentURL) && options.dontCache !== true ) {
|
||||
assetCacheWrite(assetKey, {
|
||||
|
@ -804,7 +808,12 @@ assets.get = async function(assetKey, options = {}) {
|
|||
}
|
||||
return reportBack(details.content, contentURL);
|
||||
}
|
||||
return reportBack('', '', 'ENOTFOUND');
|
||||
if ( assetRegistry[assetKey] !== undefined ) {
|
||||
registerAssetSource(assetKey, {
|
||||
error: { time: Date.now(), error }
|
||||
});
|
||||
}
|
||||
return reportBack('', '', error);
|
||||
};
|
||||
|
||||
/******************************************************************************/
|
||||
|
|
Loading…
Reference in New Issue