From 4e87782636c39664e1a911ce20498d628df3c5bd Mon Sep 17 00:00:00 2001 From: Pedro Amorim Date: Mon, 1 Jun 2026 10:43:33 +0000 Subject: [PATCH] Bug 42705: Make http-client.js handle svc endpoint error MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The afterEach calls cy.login() then immediately posts to the syspref endpoint. On CI, the machine is slow enough that the POST fires before the login redirect completes — no valid session yet — so the endpoint returns a C4::Service auth error in this format: { "type": "auth", "message": "expired" } http-client.js only knew how to parse modern REST API errors (json.error or json.errors[]). Neither field exists here, so json.errors.map(...) crashed with a TypeError instead of surfacing the actual error message. Signed-off-by: Jonathan Druart Signed-off-by: Lucas Gass --- koha-tmpl/intranet-tmpl/prog/js/fetch/http-client.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/koha-tmpl/intranet-tmpl/prog/js/fetch/http-client.js b/koha-tmpl/intranet-tmpl/prog/js/fetch/http-client.js index 2d6c771598..a1c91b7c89 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/fetch/http-client.js +++ b/koha-tmpl/intranet-tmpl/prog/js/fetch/http-client.js @@ -80,7 +80,8 @@ class HttpClient { let json = JSON.parse(text); message = json.error || - json.errors.map(e => e.message).join("\n") || + json.errors?.map(e => e.message).join("\n") || + json.message || json; } else { message = response.statusText;