igorvd
04/11/2019, 6:18 PMFlow
? I was looking at the onErrorCollect
and onErrorReturn
but I'm not sure how to use it. I'm using the simple try-catch
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.louiscad
04/11/2019, 6:25 PMigorvd
04/11/2019, 6:28 PM/**
* 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...)louiscad
04/11/2019, 6:34 PMigorvd
04/11/2019, 6:38 PMlouiscad
04/11/2019, 6:55 PMflow
, collect
, flowIn
, flowOn`, flowInChannel
, and that's all I have on the top of my head. I concluded I do not need Flow
in my apps yet, because `Channel`s and plain suspend functions currently satisfy all my needs. That will probably change when `SQLDelight gets Flow
support though.igorvd
04/11/2019, 7:32 PM