onError method
Called when an exception was occurred during the request.
Implementation
@override
void onError(DioException err, ErrorInterceptorHandler handler) {
if (error) {
if (err.type == DioExceptionType.badResponse) {
final uri = err.response?.requestOptions.uri;
_printBoxed(
header:
'DioError ║ Status: ${err.response?.statusCode} ${err.response?.statusMessage}',
text: uri.toString());
if (err.response != null && err.response?.data != null) {
logPrint('╔ ${err.type.toString()}');
_printResponse(err.response!);
}
_printLine('╚');
logPrint('');
} else {
_printBoxed(header: 'DioError ║ ${err.type}', text: err.message);
}
}
super.onError(err, handler);
}