Fix a bug thrown after waking pc up

Handle a case when all pac-script urls fwail
This commit is contained in:
ilyaigpetrov 2020-11-09 12:03:38 +00:00
parent 63f5e6fd08
commit eb996931ae

View File

@ -37,6 +37,7 @@
const timeouted = window.utils.timeouted; const timeouted = window.utils.timeouted;
const clarifyThen = window.apis.errorsLib.clarifyThen; const clarifyThen = window.apis.errorsLib.clarifyThen;
const clarify = window.apis.errorsLib.clarify;
const Warning = window.apis.errorsLib.Warning; const Warning = window.apis.errorsLib.Warning;
const httpLib = window.apis.httpLib; const httpLib = window.apis.httpLib;
@ -85,7 +86,7 @@
reject(clearErr); reject(clearErr);
return; return;
} }
createPromise().then((actionResult) => setProxyAsync().then(() => resolve(actionResult))); createPromise().then((actionResult) => setProxyAsync().then(() => resolve(actionResult)), reject);
})); }));
})); }));
}); });
@ -196,10 +197,14 @@
), ),
), ),
Promise.reject(), Promise.reject(),
).catch(
(err) => Promise.reject(clarify(
err,
chrome.i18n.getMessage('FailedToDownloadPacScriptFromAddresses') + ': [ '
+ provider.pacUrls.join(' , ') + ' ].',
)),
), ),
); ).then(
pacDataPromise.then(
(pacData) => { (pacData) => {
setPacAsync( setPacAsync(
pacData, pacData,
@ -209,11 +214,7 @@
), ),
); );
}, },
clarifyThen(
chrome.i18n.getMessage('FailedToDownloadPacScriptFromAddresses') + ': [ '
+ provider.pacUrls.join(' , ') + ' ].',
cb, cb,
),
); );
}; };
@ -390,7 +391,6 @@
syncWithPacProviderAsync( syncWithPacProviderAsync(
key = this.currentPacProvierKey, cb = throwIfError) { key = this.currentPacProvierKey, cb = throwIfError) {
if( typeof(key) === 'function' ) { if( typeof(key) === 'function' ) {
cb = key; cb = key;
key = this.getCurrentPacProviderKey(); key = this.getCurrentPacProviderKey();