diff --git a/extensions/chromium/runet-censorship-bypass/src/extension-common/37-sync-pac-script-with-pac-provider-api.tmpl.js b/extensions/chromium/runet-censorship-bypass/src/extension-common/37-sync-pac-script-with-pac-provider-api.tmpl.js index 213f650..25ce730 100644 --- a/extensions/chromium/runet-censorship-bypass/src/extension-common/37-sync-pac-script-with-pac-provider-api.tmpl.js +++ b/extensions/chromium/runet-censorship-bypass/src/extension-common/37-sync-pac-script-with-pac-provider-api.tmpl.js @@ -37,6 +37,7 @@ const timeouted = window.utils.timeouted; const clarifyThen = window.apis.errorsLib.clarifyThen; + const clarify = window.apis.errorsLib.clarify; const Warning = window.apis.errorsLib.Warning; const httpLib = window.apis.httpLib; @@ -85,7 +86,7 @@ reject(clearErr); return; } - createPromise().then((actionResult) => setProxyAsync().then(() => resolve(actionResult))); + createPromise().then((actionResult) => setProxyAsync().then(() => resolve(actionResult)), reject); })); })); }); @@ -196,10 +197,14 @@ ), ), Promise.reject(), + ).catch( + (err) => Promise.reject(clarify( + err, + chrome.i18n.getMessage('FailedToDownloadPacScriptFromAddresses') + ': [ ' + + provider.pacUrls.join(' , ') + ' ].', + )), ), - ); - - pacDataPromise.then( + ).then( (pacData) => { setPacAsync( pacData, @@ -209,11 +214,7 @@ ), ); }, - clarifyThen( - chrome.i18n.getMessage('FailedToDownloadPacScriptFromAddresses') + ': [ ' - + provider.pacUrls.join(' , ') + ' ].', - cb, - ), + cb, ); }; @@ -390,7 +391,6 @@ syncWithPacProviderAsync( key = this.currentPacProvierKey, cb = throwIfError) { - if( typeof(key) === 'function' ) { cb = key; key = this.getCurrentPacProviderKey();