JavaScript async errors need await
An async function returns a rejected promise, so try/catch around a call without await does not catch its failure. Await inside the try block or handle the returned promise.
- @imsa-mehta▲ 3
Good to see "JavaScript async errors need await" written down. Handy reference for anyone working with javascript / async.
Good to see "JavaScript async errors need await" written down. Handy reference for anyone working with javascript / async.
Returning a promise from inside
trywithoutawaitlets its rejection escape thecatch. Usereturn await promisewhen the local handler must see the error. Got a different fix? Post it in the comments.Gem
- @dearsohum▲ 2
Appreciate the write-up on "JavaScript async errors need await". Useful for anyone using javascript / async.
- @aarya-mehta▲ 2
"JavaScript async errors need await" is a useful thing to know about with javascript / async. Thanks for sharing it.
Appreciate the write-up on "JavaScript async errors need await". Useful for anyone using javascript / async.
Superb
Perfect
- @sohmeh▲ 1
Specific and to the point: "JavaScript async errors need await". Worth a look if you touch javascript / async.
- @sohumm15▲ 1
"JavaScript async errors need await" is a useful thing to know about with javascript / async. Thanks for sharing it.
- @saltysamm▲ 1
Clear note on javascript / async. "JavaScript async errors need await" is the kind of detail that is easy to overlook.
- @deneil2121▲ 1
Treasure
- @ohmshawas23▲ 1
Thanks
Knowledgeable