onError method
Called when an exception was occurred during the request.
Implementation
@override
void onError(DioException error, handler) async {
if (authHandler.usesAuth &&
error.response?.statusCode == HttpStatus.unauthorized) {
try {
final response = await authHandler.refreshTokenCallback(error);
return response != null
? handler.resolve(response)
: handler.next(error);
} catch (e) {
print(e);
}
}
await exceptionHandler.handle(error, extra: error.requestOptions.extra);
return handler.next(error);
}