WIP less cryptic errors in gui

This commit is contained in:
julian 2024-06-14 08:41:16 -06:00
parent b204d8b22e
commit 98960cac77
2 changed files with 27 additions and 4 deletions

View file

@ -285,17 +285,30 @@ class _Step3ViewState extends ConsumerState<Step3View> {
); );
if (response.value == null) { if (response.value == null) {
if (mounted) { if (context.mounted) {
Navigator.of(context).pop(); Navigator.of(context).pop();
// TODO: better errors
String? message;
if (response.exception != null) {
message =
response.exception!.toString();
if (message.startsWith(
"FormatException:",
) &&
message.contains("<html>")) {
message =
"${ref.read(efExchangeProvider).name} server error";
}
}
unawaited( unawaited(
showDialog<void>( showDialog<void>(
context: context, context: context,
barrierDismissible: true, barrierDismissible: true,
builder: (_) => StackDialog( builder: (_) => StackDialog(
title: "Failed to create trade", title: "Failed to create trade",
message: response.exception message: message ?? "",
?.toString(),
), ),
), ),
); );

View file

@ -117,13 +117,23 @@ class _StepScaffoldState extends ConsumerState<StepScaffold> {
if (mounted) { if (mounted) {
Navigator.of(context).pop(); Navigator.of(context).pop();
String? message;
if (response.exception != null) {
message = response.exception!.toString();
// TODO: better errors
if (message.startsWith("FormatException:") &&
message.contains("<html>")) {
message = "${ref.read(efExchangeProvider).name} server error";
}
}
unawaited( unawaited(
showDialog<void>( showDialog<void>(
context: context, context: context,
barrierDismissible: true, barrierDismissible: true,
builder: (_) => SimpleDesktopDialog( builder: (_) => SimpleDesktopDialog(
title: "Failed to create trade", title: "Failed to create trade",
message: response.exception?.toString() ?? "", message: message ?? "",
), ),
), ),
); );