how to handle exceptions while using `Flow`? I was...
# coroutines
how to handle exceptions while using
? I was looking at the
but I'm not sure how to use it. I'm using the simple
now, but I was wondering if it already has an API for that. My usecase is that I'm trying to write an offline-first approach: I first search on local storage and emit what it has, then I look online and emit the itens that aren't cached yet . I want to handle the exceptions (mostly networking ones) only if the local storage was empty in the first place.
I read the documentation the other day, and it was written in it. It's not too wide so I definitely recommend to check it out, and then, look at the operators documentation only when you need it. The doc is already in your IDE with the sources 😉
you mean this?
Copy code
 * Switches to the [fallback] flow if the original flow throws an exception that matches the [predicate].
Maybe I'm too newbie, but I'm not sure why it receives the fallback flow. haha I like when it has examples that I can test and see what happens. (Sure, I should try to write one...)
Hum, I don't think I read this part of the documention, but it definitely seems to be worth improvements. If you think the same, I think you should open an issue on GitHub to track this, and ask for what you think would improve understanding (e.g. an example, as you mentioned).
You can also try for yourself and contribute, of course, especially considering this is a preview API, but reporting it is already a good thing and is likely to be helpful
Yeah, you are right. I'll try to open the issue later. If this isn't the documentation you was mentioning, maybe you could send me the one you was referring? Thanks in advance 😃
I was referring to
, flowOn`,
, and that's all I have on the top of my head. I concluded I do not need
in my apps yet, because `Channel`s and plain suspend functions currently satisfy all my needs. That will probably change when `SQLDelight gets
support though.
oh, I see. I'm using it for testing and learning purposes, that's why I'm trying to implement this use case (it's common while using rxjava). 🙂