Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Retrofit Coroutine Exception Handling

See original GitHub issue

Does the current view state handle retrofit exception? E.g: 4xx or 5xx Retrofit error response/body

CMIIW, I cannot find try-catch blocks in your ViewModel, Processor, Remote & Repository to handle that

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:16 (7 by maintainers)

github_iconTop GitHub Comments

mochadwicommented, Aug 8, 2020


Previously we’re using flow builder and after a while searching on the internet, then we’re using the extension to reduce boilerplate, as stated in Kotlin Flow code it has same purpose:

Screen Shot 2020-08-08 at 8 53 50 PM

Or using method references approach:

override fun doSomething(): Flow<Abc> = repository::doAbc.asFlow()
mochadwicommented, Aug 8, 2020

Closing this issue, because it already answered our usecase. Thanks a lot & much appreciate it once again @Ezike

Read more comments on GitHub >

github_iconTop Results From Across the Web

Handling errors with Retrofit and Coroutines in a single place
When using coroutines usually the solution to deal with errors is wrapping your calls with try/catch. That's what we are about to do,...
Read more >
Retrofit — Effective error handling with Kotlin Coroutine and ...
Custom callAdapter in retrofit allows us to filter out various API error responses at a centralized level which reduces boilerplate code effectively.
Read more >
Coroutines, Retrofit, and a nice way to handle Responses
Its purpose is to return data on successful calls or handle the error through parseError(e) (which could show a Toast, Snackbar, etc…). However,...
Read more >
Kotlin Android Retrofit 2.6.0 with coroutines error handling
I am getting the API response properly with all response codes (success & error cases). My Issue is when I disconnect the internet(Wifi/mobile ......
Read more >
Modeling Retrofit Responses With Sealed Classes and ...
In this post, you will cover how to model Retrofit responses with Coroutines and Sealed classes to reduce code complexity and make your...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found