Skip to content

Commit

Permalink
🔥 Remove another .catchError
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexV525 committed Mar 15, 2024
1 parent 834f5ee commit e1399ce
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions dio/lib/src/dio_mixin.dart
Original file line number Diff line number Diff line change
Expand Up @@ -503,20 +503,21 @@ abstract class DioMixin implements Dio {
future = future.catchError(errorInterceptorWrapper(fun));
}
// Normalize errors, converts errors to [DioException].
return future.then<Response<T>>((data) {
try {
final data = await future;
return assureResponse<T>(
data is InterceptorState ? data.data : data,
requestOptions,
);
}).catchError((Object e) {
} catch (e) {
final isState = e is InterceptorState;
if (isState) {
if (e.type == InterceptorResultType.resolve) {
return assureResponse<T>(e.data, requestOptions);
}
}
throw assureDioException(isState ? e.data : e, requestOptions);
});
}
}

Future<Response<dynamic>> _dispatchRequest<T>(RequestOptions reqOpt) async {
Expand Down

0 comments on commit e1399ce

Please sign in to comment.