Bug 42705: Make http-client.js handle svc endpoint error
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 <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Pedro Amorim <pedro.amorim@openfifth.co.uk>
This commit is contained in:
parent
dc59aadc4a
commit
bdd552a05d
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in New Issue