Skip to content

Report a failed request once, in words - #457

Merged
PianoNic merged 1 commit into
mainfrom
fix/455_ErrorReporting
Aug 12, 2026
Merged

Report a failed request once, in words#457
PianoNic merged 1 commit into
mainfrom
fix/455_ErrorReporting

Conversation

@PianoNic

Copy link
Copy Markdown
Member

A failed connect showed the same failure twice: a toast reading Request failed (400) / POST /api/auth/login, and the red text under the button that actually said MFA was required. The toast was the less useful of the two and looked like a notice rather than an error.

Requests whose failure a screen renders itself are now marked ApiClient.handled(), and the interceptor skips them - so the informative message stands alone. Toasts that do fire for unhandled failures carry the server's wording instead of the HTTP verb and path.

ToastService.error now paints the destructive colour across the card, icon and text and stays up for 8 seconds; previously error, success and info differed only by icon.

Response bodies go through a shared ApiError.describe, so the user sees a sentence rather than HTTP 400: {message: ...}. It reads message/detail/title off the body, collapses a heading duplicated into its own sentence, and falls back to plain wording per status code.

account_page._syncNow also treated a DioException and any other exception differently - one toasted, one did not. Both paths are the same now.

Verified on an emulator against the full stack: a failing connect shows one red message and no toast, checked three seconds after submit.

Closes #455

Keep the global toast quiet when a screen renders the server's own message, so
a failed connect no longer shows a vague 'Request failed (400)' beside the text
that says what to do. Give error toasts the destructive colour so they read as
errors, and turn response bodies into a sentence instead of printing the map.
@PianoNic PianoNic added the bug Something isn't working label Aug 12, 2026
@PianoNic
PianoNic merged commit 3e32e8f into main Aug 12, 2026
@PianoNic
PianoNic deleted the fix/455_ErrorReporting branch August 12, 2026 19:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

A failed login is reported twice, and the toast doesn't read as an error

1 participant