UI shows raw 'Failure.errorFailure(message: …)' text in six error messages

Aperta
#327 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 2 giorni

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
78/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
dart, flutter
Ambito
frontend, testing

Direzione di ricerca

Read lib/core/error/failures.dart and test/TESTING.md, then inspect the six listed UI call sites and the four exception-wrapping call sites in gana_engine.dart and receive_share_bloc.dart. Trace whether the wrapped errors reach a screen, and add the requested widget tests for each UI spot. Done when the SnackBars show boom without the union text and the other listed paths use the message where it reaches users.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

bug good first issue P3-Low

What users see

Some error messages show Dart's internal text instead of the message. For example, a failed relay add shows

Could not add relay: Failure.errorFailure(message: connection refused)

instead of Could not add relay: connection refused.

Cause

Failure is a freezed union, so toString() prints the variant name and field (Failure.errorFailure(message: …)). Failure.toMessage() (lib/core/error/failures.dart) returns just the message, and 49 call sites already use it. These six UI spots call toString() instead:

File Line Shown to the user
lib/common/widgets/relay_selector_field.dart 113 add-relay error
lib/features/settings/widgets/identity_card.dart 389 add-relay error
lib/features/settings/widgets/identity_card.dart 429 relay error
lib/features/settings/widgets/logout_button.dart 126 logout error
lib/common/qr/uniun_qr_scanner_page.dart 120 QR-login failed
lib/common/qr/uniun_qr_scanner_page.dart 158 follow from QR failed

Four more spots wrap f.toString() in an exception: gana_engine.dart lines 616, 642 and 693, and receive_share_bloc.dart line 305. That raw text then becomes the exception's message. Check whether any of it reaches the screen, for example a Gana run's failure reason.

Fix

  • Replace f.toString() with f.toMessage() at each UI spot.
  • For each spot, add a widget test that makes the use case return Left(Failure.errorFailure('boom')) and expects boom without Failure.errorFailure( in the SnackBar. Follow test/TESTING.md.

Small and self-contained, so a good first issue.

Lingua principale
Dart
Stelle
2
Fork
2
Merge medio
3g 5h
PR unite (30g)
10

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di basictech01/uniun

Tutte le issue di basictech01/uniun

Issue simili

Altre issue su Dart

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.