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

オープン
#327 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 2 日以内に返信

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
78/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
dart, flutter
領域
frontend, testing

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

説明

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.

主要言語
Dart
スター
2
フォーク
2
平均マージ
3日 5時間
マージ済み PR(30日)
10

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

basictech01/uniun のほかの issue

basictech01/uniun の issue をすべて見る

似ている issue

Dart の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。