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

            Bug ID: 43582
           Summary: Allow Vue API clients to opt out of the shared
                    HttpClient's generic error banner
   Initiative type: ---
        Sponsorship ---
            status:
           Product: Koha
           Version: Main
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P5 - low
         Component: Staff interface
          Assignee: [email protected]
          Reporter: [email protected]
        QA Contact: [email protected]
                CC: [email protected]
  Target Milestone: ---

The shared Vue HttpClient
(koha-tmpl/intranet-tmpl/prog/js/vue/fetch/http-client.js) unconditionally
calls the global setError() helper on any failed API request (see _fetchJSON's
.catch(err => { error = err; setError(err); })), showing a generic "Something
went wrong: <raw error>" banner regardless of whether the calling component
already handles and displays the error itself.

This means any Vue component that wants to show its own friendly, translated,
context-specific error message ends up showing BOTH the generic banner and its
own message for the same failure. This was noticed while testing bug 35837
(Plugin store): a failed plugin install shows both "Something went wrong:
Error: SIGNATUREMISMATCH" (global, raw error code) and "This file's signature
doesn't match what the store signed -- it may have been altered or corrupted."
(local, friendly translated message) at the same time, for the same failure.

At least one existing component (RecordSourcesResource.vue) works around this
today by supplying an empty local error handler and relying solely on the
global banner -- but that means a component can't have both structured/friendly
local messaging AND suppress the redundant generic one.

This bug proposes adding an opt-out parameter to HttpClient's request methods
(get/getAll/post/postForm/etc, threaded through to _fetchJSON) so a caller
that's already going to display its own error message can skip the automatic
global setError() call for that request, instead of duplicating the message on
screen.

Test plan:
1. Pick a Vue component that calls a REST endpoint and currently shows its own
local error message on failure (e.g. the Plugin store install flow from bug
35837, once landed, triggering a SIGNATUREMISMATCH or similar 403).
2. Confirm today both the generic "Something went wrong: ..." banner and the
component's own local error message are shown together.
3. Apply this enhancement's patch and have the component pass the new opt-out
flag on its API call.
4. Confirm only the component's own local error message is shown, with no
duplicate generic banner.
5. Confirm other, unrelated Vue components that do NOT pass the new flag are
unaffected and still show the generic banner as before.

-- 
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