diff --git a/dev/Remote/AbstractFetch.js b/dev/Remote/AbstractFetch.js index 2165a336c..c317cc4a7 100644 --- a/dev/Remote/AbstractFetch.js +++ b/dev/Remote/AbstractFetch.js @@ -67,14 +67,7 @@ fetchJSON = (action, sGetAdd, params, timeout, jsonCallback) => { oRequests[action] = controller; init.signal = controller.signal; } - return rl.fetchJSON(getURL(sGetAdd), init, sGetAdd ? null : params) - .then(jsonCallback) - .catch(err => { - if (err.name == 'AbortError') { // handle abort() - err = Notification.JsonAbort; - } - return Promise.reject(err); - }); + return rl.fetchJSON(getURL(sGetAdd), init, sGetAdd ? null : params).then(jsonCallback); }; addEventListener('unload', () => bUnload = true); @@ -103,7 +96,7 @@ export class AbstractFetchRemote abortActions.forEach(actionToAbort => abort(actionToAbort)); } - return fetchJSON(sAction, sGetAdd, + fetchJSON(sAction, sGetAdd, params, undefined === iTimeout ? 30000 : pInt(iTimeout), data => { @@ -163,7 +156,11 @@ export class AbstractFetchRemote break; } } - ); + ) + .catch(err => { + console.error(err); + fCallback && fCallback(err.name == 'AbortError' ? Notification.JsonAbort : StorageResultType.Error); + }); } /** diff --git a/dev/Remote/Admin/Fetch.js b/dev/Remote/Admin/Fetch.js index e62c66947..d8ef53928 100644 --- a/dev/Remote/Admin/Fetch.js +++ b/dev/Remote/Admin/Fetch.js @@ -128,7 +128,7 @@ class RemoteAdminFetch extends AbstractFetchRemote { * @param {boolean} bDisabled */ domainDisable(fCallback, sName, bDisabled) { - return this.defaultRequest(fCallback, 'AdminDomainDisable', { + this.defaultRequest(fCallback, 'AdminDomainDisable', { Name: sName, Disabled: bDisabled ? 1 : 0 }); @@ -139,7 +139,7 @@ class RemoteAdminFetch extends AbstractFetchRemote { * @param {Object} oConfig */ pluginSettingsUpdate(fCallback, oConfig) { - return this.defaultRequest(fCallback, 'AdminPluginSettingsUpdate', oConfig); + this.defaultRequest(fCallback, 'AdminPluginSettingsUpdate', oConfig); } /** @@ -148,7 +148,7 @@ class RemoteAdminFetch extends AbstractFetchRemote { * @param {boolean} bDisabled */ pluginDisable(fCallback, sName, bDisabled) { - return this.defaultRequest(fCallback, 'AdminPluginDisable', { + this.defaultRequest(fCallback, 'AdminPluginDisable', { Name: sName, Disabled: bDisabled ? 1 : 0 }); diff --git a/dev/Remote/User/Fetch.js b/dev/Remote/User/Fetch.js index c02954f91..936a2d7eb 100644 --- a/dev/Remote/User/Fetch.js +++ b/dev/Remote/User/Fetch.js @@ -340,7 +340,7 @@ class RemoteUserFetch extends AbstractFetchRemote { }; } - return this.defaultRequest( + this.defaultRequest( fCallback, 'MessageList', params, diff --git a/dev/bootstrap.js b/dev/bootstrap.js index a9c453f0d..10834a00e 100644 --- a/dev/bootstrap.js +++ b/dev/bootstrap.js @@ -109,8 +109,7 @@ export default (App) => { return fetch(resource, init).then(response => { if (!response.ok) { -// return Promise.reject('Network response error: ' + response.status); - throw new Error('Network response error: ' + response.status); + return Promise.reject('Network response error: ' + response.status); } /* TODO: use this for non-developers? response.clone()