improving error handling

This commit is contained in:
2026-06-25 00:28:45 +02:00
parent a31e38765d
commit 664cefcecd
4 changed files with 36 additions and 14 deletions

View File

@@ -170,13 +170,28 @@ class _PayScreenState extends State<PayScreen> with TickerProviderStateMixin {
final apiResponse = await controller.doTransaction();
if (!apiResponse.isSuccess) {
if (context.mounted) {
AppSnackBar.showError(
context,
String errorMessage =
controller.model.errorMessage ??
apiResponse.error ??
"Transaction failed",
);
apiResponse.error ??
"Transaction failed";
if (context.mounted) {
if (errorMessage.contains(
"We can't process that transaction right now",
)) {
AppSnackBar.show(
context,
errorMessage,
action: SnackBarAction(
label: 'Check uptime',
textColor: Colors.yellow, // Optional custom styling
onPressed: () {
context.push('/uptime');
},
),
);
} else {
AppSnackBar.showError(context, errorMessage);
}
}
} else if (controller.model.status == "SUCCESS" && context.mounted) {
context.push('/confirm');