mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2024-12-23 11:59:30 +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 (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(),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
|
@ -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 ?? "",
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in a new issue