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

Update code to remove "return new Promise()" in subroutines #77

Open
Misterblue opened this issue Feb 23, 2021 · 0 comments
Open

Update code to remove "return new Promise()" in subroutines #77

Misterblue opened this issue Feb 23, 2021 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@Misterblue
Copy link
Collaborator

Misterblue commented Feb 23, 2021

I used the previous convention of returning a "new Promise()" in subroutines that return a Promise. But Javascript will wrap things in Promises if one doesn't do that. So, the popular convention these days is to just return the value and throw the error and let Javascript do the Promise magic.

Related is using await/try/catch instead of .then/.catch. This sometimes creates less verbose code.

@Misterblue Misterblue added the enhancement New feature or request label Feb 23, 2021
@Misterblue Misterblue self-assigned this Feb 23, 2021
@Misterblue Misterblue changed the title Update code to use remove "return new Promise()" in subroutines Update code to remove "return new Promise()" in subroutines Feb 23, 2021
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
None yet
Development

No branches or pull requests

1 participant