- Ignore Socket Exception "bad file descriptor"

- Add nullability to anypay API response failure [skip ci]
This commit is contained in:
OmarHatem 2023-02-03 14:44:13 +02:00
parent f5fa87abfd
commit d85805902d
2 changed files with 6 additions and 5 deletions

View file

@ -80,7 +80,7 @@ class AnyPayApi {
final response = await post(Uri.parse(uri), headers: headers, body: utf8.encode(json.encode(body)));
if (response.statusCode == 400) {
final decodedBody = json.decode(response.body) as Map<String, dynamic>;
throw Exception(decodedBody['message'] as String);
throw Exception(decodedBody['message'] as String? ?? 'Unexpected response\nError code: 400');
}
if (response.statusCode != 200) {