-
Notifications
You must be signed in to change notification settings - Fork 305
"The MaybeSource is empty" error occurs with persister #305
Comments
That's what confuses me most, why return |
I'm confused how it can be empty when you do store.fetch. Fetch should get a new element from your fetcher save it to disk and then return. Could you post a failing test or sample please. |
@digitalbuddha What if what the What we normally would do is Now, if we could fetch nothing from network etc. (of course there's a response but nothing we could write into persister and use case like this is not rare), the One may say hey, why don't you return a empty object (not null) from persister for the situation like this. If we do that, when we So the problem is why should we assume that |
Using
|
I have same problem - how to distinguish between "not found in cache" and "not found on API" (both should return list of items) in persister's |
Thanks for explaining! We are working on store4 and will make an elegant solution. I'll post possible solutions here. Open to suggestions as well |
In README.md, there's a sample code contains:
With this reference code, I wrote my own persister like:
and then i made a request like
store.fetch(key)
But it occurs
java.util.NoSuchElementException: The MaybeSource is empty
I followed inside RealInternalStore.java,
there's weird code in
RealInternalStore.response()
readDisk()
doesn't have code for handling empty state,readDisk(key).toSingle()
can occursNoSuchElementException
How can I return "empty, there's no saved response" state in
Persister.read()
?The text was updated successfully, but these errors were encountered: