You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
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
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.
The text was updated successfully, but these errors were encountered: