diff --git a/example/pubspec.lock b/example/pubspec.lock index 76be80c..9f19e07 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -395,7 +395,7 @@ packages: path: ".." relative: true source: path - version: "4.1.0" + version: "5.0.1" vm_service: dependency: transitive description: diff --git a/lib/src/mixin/network_manager_error_interceptor.dart b/lib/src/mixin/network_manager_error_interceptor.dart index edf24f3..11fe21b 100644 --- a/lib/src/mixin/network_manager_error_interceptor.dart +++ b/lib/src/mixin/network_manager_error_interceptor.dart @@ -53,10 +53,17 @@ mixin NetworkManagerErrorInterceptor { } // Call onResponseParse callback and return response return handler.resolve(parameters.onResponseParse!(response)); - } catch (_) { + } catch (err) { /// cancel request & call onRefreshFail callback and unlock error.requestOptions.cancelToken?.cancel(); parameters.onRefreshFail?.call(); + + /// If error is DioException, then return error + if (err is DioException) { + return handler.next(err); + } + + /// If error is not DioException, then return error return handler.next(exception); } },