failure function
AngelHttpException
failure(
- Response response, {
- dynamic error,
- String? message,
- StackTrace? stack,
Implementation
AngelHttpException failure(Response response,
{error, String? message, StackTrace? stack}) {
try {
var v = json.decode(response.body);
if (v is Map && (v['is_error'] == true) || v['isError'] == true) {
return AngelHttpException.fromMap(v as Map);
} else {
return AngelHttpException(
message: message ??
'Unhandled exception while connecting to Angel backend.',
statusCode: response.statusCode,
stackTrace: stack);
}
} catch (e, st) {
return AngelHttpException(
message: message ??
'Angel backend did not return JSON - an error likely occurred.',
statusCode: response.statusCode,
stackTrace: stack ?? st);
}
}