Async & Await / Promises
Async
Main function
With Promises
Promise
s
Promise
sWhen you start chaining a lot of promises and passing variables around, consider usings aysnc
instead.
Pay attention to the style, because it's really stupid.
Always have a
catch()
to ensure you can see all errors.
Promise.all
Gotcha:
You have to call
.catch()
on each of the promisesYou should only catch things which are idempotent; for example:
Sending emails
Last updated