https://kotlinlang.org logo
#coroutines
Title
# coroutines
p

Paul Woitaschek

11/07/2019, 9:20 AM
I need help 🙂 I have an issue with undeclared throwables in retrofit when switching to Dispatchers.Main.Immediate. https://github.com/square/retrofit/issues/3128#issuecomment-550989230 https://jakewharton.com/exceptions-and-proxies-and-coroutines-oh-my/ What's so special with
Dispatchers.Main.immediate
that causes this behavior?
@jw cc
o

octylFractal

11/07/2019, 9:45 AM
I suspect the key is in this line from the article:
This indicates a checked exception was somehow being synchronously thrown.
the immediate dispatcher always runs synchronously if possible, without a suspend boundary, so you can have the exception thrown in the proxy quite easily
p

Paul Woitaschek

11/07/2019, 9:53 AM
I hope this can be fixed. Just refactoring everything back to singles now for my release -.-
l

louiscad

11/07/2019, 11:28 AM
I'd just use
Dispatchers.Main
when dealing with retrofiit to avoid that issue. I'm wondering if you could have the issue when using
Dispatchers.Default
or
<http://Dispatchers.IO|Dispatchers.IO>
too 🤔
p

Paul Woitaschek

11/07/2019, 11:30 AM
In my case it's the viewmodel which collects from a flow on the immediate dispatcher as default because else there are artifacts when one source of the viewstate flow is a user input event. To my viewmodel it's not transparent that there is room somewhere in the chain, it originates somewhere in a repository
8 Views