feat(web): humanize pre-scan upload and credential errors#414
Merged
Conversation
The scan form surfaced raw exception text on a failed upload or token stash: the server's literal error string, an HTTP status, or the browser's "Failed to fetch". A non-developer gets no usable guidance from any of those. Carry the HTTP status on a typed ApiError from the /upload and /git-cred clients, map failures to four situation-specific messages (too large, unreachable server, server error, rejected input) in both locales, and keep the raw server text as muted fine print for bug reports instead of the headline. 413 drops the redundant detail line entirely. The upload e2e spec now asserts the humanized headline is shown and the raw server text is not.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
A failed upload or token stash on the New scan form showed
(e as Error).messageverbatim — the server's raw error string, an HTTP status, or the browser's "Failed to fetch". For the non-developer audience this reads as a malfunction with no next step.What
api.ts:/uploadand/git-credclients now throw a typedApiErrorcarrying the HTTP status; added a puredescribeUploadError()mapper.Verification
tsc --noEmit, vitest 216/216, i18n coverage en ≡ ko (530 keys), token lint — passplaywright test tests/ui/upload.spec.ts— 2/2 pass