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

连接超时的情况下 直接抛异常不好吧 #472

Closed
zhanghaigang666 opened this issue Sep 21, 2019 · 1 comment
Closed

连接超时的情况下 直接抛异常不好吧 #472

zhanghaigang666 opened this issue Sep 21, 2019 · 1 comment

Comments

@zhanghaigang666
Copy link

连接超时的情况下,直接抛异常,调用者拿不到回调,这样处理不好吧
E/flutter (21154): [ERROR:flutter/lib/ui/ui_dart_state.cc(148)] Unhandled Exception: DioError [DioErrorType.CONNECT_TIMEOUT]: Connecting timed out [10000ms]
E/flutter (21154): #0 DioMixin._dispatchRequest (package:dio/src/dio.dart:943:7)
E/flutter (21154):
E/flutter (21154): #1 DioMixin._request._interceptorWrapper... (package:dio/src/dio.dart:828:37)
E/flutter (21154): #2 DioMixin.checkIfNeedEnqueue (package:dio/src/dio.dart:1100:22)
E/flutter (21154): #3 DioMixin._request._interceptorWrapper.. (package:dio/src/dio.dart:825:22)
E/flutter (21154): #4 new Future. (dart:async/future.dart:176:37)
E/flutter (21154): #5 _rootRun (dart:async/zone.dart:1120:38)
E/flutter (21154): #6 _CustomZone.run (dart:async/zone.dart:1021:19)
E/flutter (21154): #7 _CustomZone.runGuarded (dart:async/zone.dart:923:7)
E/flutter (21154): #8 _CustomZone.bindCallbackGuarded. (dart:async/zone.dart:963:23)
E/flutter (21154): #9 _rootRun (dart:async/zone.dart:1124:13)
E/flutter (21154): #10 _CustomZone.run (dart:async/zone.dart:1021:19)
E/flutter (21154): #11 _CustomZone.bindCallback. (dart:async/zone.dart:947:23)
E/flutter (21154): #12 Timer._createTimer. (dart:async-patch/timer_patch.dart:21:15)
E/flutter (21154): #13 _Timer._runTimers (dart:isolate-patch/timer_impl.dart:382:19)
E/flutter (21154): #14 _Timer._handleMessage (dart:isolate-patch/timer_impl.dart:416:5)
E/flutter (21154): #15 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:172:12)
E/flutter (21154):

@zhanghaigang666
Copy link
Author

try可以捕获到,我的错,以为捕获不到,忘保存测试代码了

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

1 participant