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

Refactor any (Bb)Promise[resolve, reject] constructs #8603

Open
medikoo opened this issue Dec 10, 2020 · 0 comments
Open

Refactor any (Bb)Promise[resolve, reject] constructs #8603

medikoo opened this issue Dec 10, 2020 · 0 comments
Labels

Comments

@medikoo
Copy link
Contributor

medikoo commented Dec 10, 2020

Use case description

Should be addressed after #8369

Paves path to #7171

Using Promise.resolve or Promise.reject in 99.99% of case signals bad pattern. Same with new Promise() constructs (if we convert async non promise construct, it's usually better to rely on existing generic utility that does that)

We have many such occurrences in our code, as it predates async/await, and BbPromise.try was not explored as an alternative.

Proposed solution

  • Replace any BbPromise.resolve and Promise.resolve usage with direct value usage
  • Replace any BbPromise.reject and Promise.reject usage with direct exception throws
  • If possible replace any new Promise and new BbPromise constructs, so existing utils are used instead (e.g. stream-promise for converting stream to promise). For cases where promise construction is confirmed to be valid, ensure it's a new Promise (and not new BbPromise) and report such occurrence in this issue.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant