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

Abierto
#327 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 2 días

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
78/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
dart, flutter
Área
frontend, testing

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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.

Lenguaje dominante
Dart
Estrellas
2
Forks
2
Merge medio
3 d 5 h
PR fusionados (30 d)
10

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de basictech01/uniun

Todos los issues de basictech01/uniun

Issues similares

Más issues de Dart

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.