From 5db8f032b8d5a969b2a8a02888609535e5265f59 Mon Sep 17 00:00:00 2001 From: djmaze Date: Wed, 25 Aug 2021 12:00:50 +0200 Subject: [PATCH] Resolve issue #123 --- dev/App/User.js | 4 ++-- dev/Remote/AbstractFetch.js | 14 ++++++++++++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/dev/App/User.js b/dev/App/User.js index 048bd2aa6..8322b0ae4 100644 --- a/dev/App/User.js +++ b/dev/App/User.js @@ -380,8 +380,8 @@ class AppUser extends AbstractApp { .then(() => promise) .then( () => Remote.foldersReloadWithTimeout(), - errorCode => { - FolderUserStore.folderListError(getNotification(errorCode, '', errorDefCode)); + error => { + FolderUserStore.folderListError(getNotification(error.code, '', errorDefCode) + '.\n' + error.message); Remote.foldersReloadWithTimeout(); } ); diff --git a/dev/Remote/AbstractFetch.js b/dev/Remote/AbstractFetch.js index 84a10ad64..8cd290d97 100644 --- a/dev/Remote/AbstractFetch.js +++ b/dev/Remote/AbstractFetch.js @@ -63,6 +63,14 @@ fetchJSON = (action, sGetAdd, params, timeout, jsonCallback) => { return rl.fetchJSON(getURL(sGetAdd), init, sGetAdd ? null : params).then(jsonCallback); }; +class FetchError extends Error +{ + constructor(code, message) { + super(message); + this.code = code || Notification.JsonFalse; + } +} + export class AbstractFetchRemote { abort(sAction, bClearOnly) { @@ -201,8 +209,10 @@ export class AbstractFetchRemote if (!data.Result || action !== data.Action) { checkResponseError(data); - const err = data ? data.ErrorCode : 0; - return Promise.reject(err || Notification.JsonFalse); + return Promise.reject(new FetchError( + data ? data.ErrorCode : 0, + data ? (data.ErrorMessageAdditional || data.ErrorMessage) : '' + )); } return data;