https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43516

--- Comment #4 from Martin Renvoize (ashimema) 
<[email protected]> ---
Created attachment 205545
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=205545&action=edit
Bug 43516: Add a shared, translated API error formatter

Add fetch/api-error.js: a small formatApiError() helper that turns a
thrown API error into a translated, user-facing message. Recognises
401 (session expired), 403 (not authorized), a network failure (fetch
itself never reaching the server), and falls back to a generic
message carrying the raw error text when available.

Split out from bug 41129 (booking workflows) as generic frontend
infrastructure.

Test plan:
1. Run: yarn cypress run --component --browser electron --spec
   't/cypress/component/fetch/api-error_spec.ts'
2. Verify all specs pass.

Co-authored-by: Jacob O'Mara <[email protected]>
Co-authored-by: Martin Renvoize <[email protected]>
Sponsored-by: Büchereizentrale Schleswig-Holstein <https://www.bz-sh.de/>
Assisted-by: Opus 4.8 (Anthropic)
Assisted-by: GPT 5.6 (OpenAI)
Signed-off-by: Martin Renvoize <[email protected]>
Signed-off-by: Jacob O'Mara <[email protected]>
Signed-off-by: Paul Derscheid <[email protected]>

-- 
You are receiving this mail because:
You are watching all bug changes.
You are the assignee for the bug.
_______________________________________________
Koha-bugs mailing list -- [email protected]
To unsubscribe send an email to [email protected]
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to