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

When first call encounter exception, the function always return exception #79

Closed
zacyang opened this issue Jul 16, 2021 · 1 comment
Closed

Comments

@zacyang
Copy link

zacyang commented Jul 16, 2021

Notice the cache did not distinguish error from regular return, meaning if first try failed, all the subsequent call will fai.
Can we add a configure to allow only cache the success return?

@fregante
Copy link
Collaborator

The result of functions isn't stored if they throw errors, but rejected promises are indeed stored. What you're asking is covered by p-memoize, which is a mem wrapper

https://github.com/sindresorhus/p-memoize#cachepromiserejection

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants