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

Aberta
#327 0 comentários 0 reações 0 responsáveis Ver no GitHub

Mantenedores costumam responder em até 2 dias

Ninguém assumiu esta issue ainda.

Avaliação

Dificuldade
3/5
Tempo estimado
1-2 dias
Facilidade para iniciantes
78/100
Tipo de issue
Bug
Clareza
Claramente especificada
Status de atividade
Ativa
Stack de tecnologia
dart, flutter
Domínio
frontend, testing

Direção de pesquisa

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.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

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.

Linguagem predominante
Dart
Estrelas
2
Forks
2
Merge médio
3d 5h
PRs com merge (30d)
10

Preparar o ambiente

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de basictech01/uniun

Todas as issues de basictech01/uniun

Issues semelhantes

Mais issues de Dart

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.