Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DioError [DioErrorType.other]: Invalid argument(s) (onError): The error handler of Future.catchError must return a value of the future's type #1432

Closed
1 task done
JanKokalj opened this issue Feb 21, 2022 · 1 comment

Comments

@JanKokalj
Copy link

New Issue Checklist

  • I have searched for a similar issue in the project and found none

Issue Info

Info Value
Platform Name Android
Platform Version 10.0
Dio Version 4.0.4
Android Studio / Xcode Version IntelliJ 2021.3.2
Repro rate Hard to reproduce

Issue Description and Steps

This is hard to reproduce. It happens when our app is in the foreground and you lock the screen of the device, then after about half an hour later, you unlock the device (we fetch new data), and then this exception happens (the same request and all other requests are working in other scenarios/times). I could not find anything related to this on the internet so I am opening an issue here to get some more insights. The stack traces are:

Non-fatal Exception: io.flutter.plugins.firebase.crashlytics.FlutterError: DioError [DioErrorType.other]: Invalid argument(s) (onError): The error handler of Future.catchError must return a value of the future's type
#0      _FutureListener.handleError (dart:async/future_impl.dart:194)
#1      Future._propagateToListeners.handleError (dart:async/future_impl.dart:779)
#2      Future._propagateToListeners (dart:async/future_impl.dart:800)
#3      Future._completeError (dart:async/future_impl.dart:610)
#4      Future._asyncCompleteError.<anonymous closure> (dart:async/future_impl.dart:666)
#5      _rootRun (dart:async/zone.dart:1428)
#6      _CustomZone.run (dart:async/zone.dart:1328)
#7      _CustomZone.runGuarded (dart:async/zone.dart:1236)
#8      _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:1276)
#9      _microtaskLoop (dart:async/schedule_microtask.dart:40)
#10     _startMicrotaskLoop (dart:async/schedule_microtask.dart:49)

Source stack:
#0      DioMixin.fetch (package:dio/src/dio_mixin.dart:473)
#1      DioMixin.request (package:dio/src/dio_mixin.dart:468)
#2      DioMixin.get (package:dio/src/dio_mixin.dart:55)
#3      AuthenticatedHttpClientImpl.get.<anonymous closure> (package:/../layers/network/http_client/authenticated_http_client_impl.dart:93)

Relevant code:

late Dio _dioClient;

_dioClient = Dio();

_dioClient.get(
        uri.toString(),
        options: Options(
          extra: _createExtraMap(requiresAuthToken),
          responseType: ResponseType.plain,
          headers: headers,
        ),
      )
@Thembelani-M
Copy link

Hi @AlexV525. Why was this closed ?
Hi @JanKokalj Did you find out what was causing this issue ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants