Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request] getOrError and freshOrError #553

Open
matt-ramotar opened this issue May 21, 2023 · 2 comments
Open

[Feature Request] getOrError and freshOrError #553

matt-ramotar opened this issue May 21, 2023 · 2 comments
Labels
enhancement New feature or request

Comments

@matt-ramotar
Copy link
Collaborator

Additionally: have you considered adding a getOrError() (and freshOrError()) that return a Result to the API? These are two functions I end up readding into all of my projects using Store, since the appropriate way to have a fetcher fail is by throwing. Which is fine if you're using .stream(), and much less fun if you forgot about that detail and called get() blindly

https://www.reddit.com/r/androiddev/comments/13mb2sz/comment/jkwwjxs/?utm_source=share&utm_medium=web2x&context=3

@matt-ramotar matt-ramotar added the enhancement New feature or request label May 21, 2023
@github-project-automation github-project-automation bot moved this to 🆕 Triage in Store Roadmap May 21, 2023
@digitalbuddha
Copy link
Contributor

Would this function any different than runCatching{ store.get()}

@pikzen
Copy link

pikzen commented May 21, 2023

Being the one that suggested it: absolutely not! However, I have noticed amongst my teams that it is relatively easy to forget about the fact that stores can throw (and seem to be expected to in Fetchers should anything go wrong). Having it part of the default API helps remember that, and is close to the kotlin .get/.getOrNull() equivalents

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: 🆕 Triage
Development

No branches or pull requests

3 participants