mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2024-12-23 03:49:22 +00:00
WIP less cryptic errors in gui
This commit is contained in:
parent
b204d8b22e
commit
98960cac77
2 changed files with 27 additions and 4 deletions
|
@ -285,17 +285,30 @@ class _Step3ViewState extends ConsumerState<Step3View> {
|
|||
);
|
||||
|
||||
if (response.value == null) {
|
||||
if (mounted) {
|
||||
if (context.mounted) {
|
||||
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(
|
||||
showDialog<void>(
|
||||
context: context,
|
||||
barrierDismissible: true,
|
||||
builder: (_) => StackDialog(
|
||||
title: "Failed to create trade",
|
||||
message: response.exception
|
||||
?.toString(),
|
||||
message: message ?? "",
|
||||
),
|
||||
),
|
||||
);
|
||||
|
|
|
@ -117,13 +117,23 @@ class _StepScaffoldState extends ConsumerState<StepScaffold> {
|
|||
if (mounted) {
|
||||
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(
|
||||
showDialog<void>(
|
||||
context: context,
|
||||
barrierDismissible: true,
|
||||
builder: (_) => SimpleDesktopDialog(
|
||||
title: "Failed to create trade",
|
||||
message: response.exception?.toString() ?? "",
|
||||
message: message ?? "",
|
||||
),
|
||||
),
|
||||
);
|
||||
|
|
Loading…
Reference in a new issue