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

Ouverte
#327 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Les mainteneurs répondent en général sous 2 jours

Personne n'a encore pris cette issue.

Évaluation

Difficulté
3/5
Temps estimé
1-2 jours
Accessibilité débutants
78/100
Type d'issue
Bug
Clarté
Clairement spécifiée
Activité
Active
Stack technique
dart, flutter
Domaine
frontend, testing

Piste de recherche

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.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

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.

Langage dominant
Dart
Étoiles
2
Forks
2
Merge moyen
3 j 5 h
PR mergées (30 j)
10

Préparer son environnement

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de basictech01/uniun

Toutes les issues de basictech01/uniun

Issues similaires

Plus d'issues Dart

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.