handleErrorMessage static method
dynamic
handleErrorMessage(
- Response response
Implementation
static handleErrorMessage(Response response) {
if (response.statusCode != 200 && response.statusCode != 204) {
try {
throw ErrorResponseException.fromJson(json.decode(response.body));
}
on ErrorResponseException catch(e) {
rethrow;
}
catch (e) {
throw ErrorResponseException.fromJson({
'code': response.statusCode.toString(),
'message': response.reasonPhrase,
});
}
}
}