stream-feed-flutter icon indicating copy to clipboard operation
stream-feed-flutter copied to clipboard

Errorbuilder not being called in FlatFeedCore

Open Cteq3132 opened this issue 3 years ago • 1 comments

Describe the bug When i am in airplane mode and try to load the FlatFeedCore, it stays in loading mode instead of going into the error builder function.

What version of Flutter do you use? 2.10.5

What package are you using? What version? stream_feed_flutter_core: ^0.7.0+1

What platform is it about?

  • [x] Android
  • [x] iOS
  • [ ] Web
  • [ ] Windows
  • [ ] MacOS
  • [ ] Linux And maybe the other but I had not test.

a copy of flutter doctor --verbose

To Reproduce Steps to reproduce the behavior:

  1. Open Flutter Instagram Clone
  2. Click on the first user
  3. Disable internet before the FlatFeedCore is loading
  4. FlatFeedCore stuck in loading

Expected behavior Errorbuilder being called

Screenshots If applicable, add screenshots to help explain your problem.

**Logs **

Additional context The following is showed in the debug console:

/flutter ( 6242): (2022-04-26 18:26:11.178332) 🚨 📜
I/flutter ( 6242): (2022-04-26 18:26:11.180167) 🚨 📜 ╔╣ DioError ║ DioErrorType.other
I/flutter ( 6242): (2022-04-26 18:26:11.180291) 🚨 📜 ║  SocketException: Failed host lookup: 'api.stream-io-api.com' (OS Error: No address associated with hostname, errno = 7)
I/flutter ( 6242): (2022-04-26 18:26:11.180402) 🚨 📜 ╚════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════╝
I/flutter ( 6242): (2022-04-26 18:26:11.182177) 🚨 📜
I/flutter ( 6242): (2022-04-26 18:26:11.182942) 🚨 📜 ╔╣ Request ║ GET
I/flutter ( 6242): (2022-04-26 18:26:11.183019) 🚨 📜 ║  https://api.stream-io-api.com/api/v1.0/enrich/feed/timeline/test-user/?api_key=api_key&location=unspecified&limit=10&offset=0&with_recent_reactions=true&with_reaction_counts=true
I/flutter ( 6242): (2022-04-26 18:26:11.183362) 🚨 📜 ╚════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════╝

Cteq3132 avatar Apr 26 '22 14:04 Cteq3132

Hey @Cteq3132 thanks for opening an issue, looks like Dio did not catch the error. I think we can fix this with an Interceptor

 InterceptorsWrapper(
        onError: (error, handler) {
          // Do stuff here
          handler.reject(error); // Added this line to let error propagate outside the interceptor
        },
      ),

sachaarbonel avatar Apr 26 '22 15:04 sachaarbonel