From 02c16ca8d936f8013e67ac585b94421f553ff42c Mon Sep 17 00:00:00 2001 From: KarpAlex Date: Thu, 28 Dec 2023 15:20:42 +0100 Subject: [PATCH] RESTClient: get Error method works with string error messages --- public/js/RESTClient.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/public/js/RESTClient.js b/public/js/RESTClient.js index 66e046af9..6a1632d0d 100644 --- a/public/js/RESTClient.js +++ b/public/js/RESTClient.js @@ -120,10 +120,9 @@ export const CoreRESTClient = { * Retrives error message from response object */ getError: function(response) { - - if (typeof response[CORE_REST_CLIENT_RETVAL] === "object" - && Object.keys(response[CORE_REST_CLIENT_RETVAL]).length > 0 - && response.hasOwnProperty(CORE_REST_CLIENT_RETVAL)) + if (response.hasOwnProperty(CORE_REST_CLIENT_RETVAL) + && ((typeof response[CORE_REST_CLIENT_RETVAL] === "object" && Object.keys(response[CORE_REST_CLIENT_RETVAL]).length > 0) + || (typeof response[CORE_REST_CLIENT_RETVAL] === "string" && response[CORE_REST_CLIENT_RETVAL].trim() != ""))) { return response[CORE_REST_CLIENT_RETVAL]; }