🥅 Properly display error responses
This commit is contained in:
@ -111,6 +111,29 @@ class _GoMixHomeState extends State<GoMixHome> {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (data["type"] == "error") {
|
||||||
|
String errorMessage = "";
|
||||||
|
try {
|
||||||
|
errorMessage = data["responseData"]["error"];
|
||||||
|
} catch (e) {
|
||||||
|
errorMessage = "Unknown error";
|
||||||
|
}
|
||||||
|
|
||||||
|
showDialog<String>(
|
||||||
|
context: context,
|
||||||
|
builder: (BuildContext context) => AlertDialog(
|
||||||
|
title: const Text('Server error'),
|
||||||
|
content: Text(errorMessage),
|
||||||
|
actions: <Widget>[
|
||||||
|
TextButton(
|
||||||
|
onPressed: () => Navigator.pop(context, 'OK'),
|
||||||
|
child: const Text('OK'),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
}, onDone: () {
|
}, onDone: () {
|
||||||
wsConnected = false;
|
wsConnected = false;
|
||||||
if (connectionError.value != "") return;
|
if (connectionError.value != "") return;
|
||||||
|
Reference in New Issue
Block a user