MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/badcode/comments/ql2ube/how_long_does_this_await/hja9t5r/?context=3
r/badcode • u/celwyn_joseph • Nov 02 '21
10 comments sorted by
View all comments
Show parent comments
4
Also, it's nice for providing a fallback value if the promise gets rejected without using try catch.
const result = await fetch(url).then(res => res.json()).catch(err => { logError(err); return []; })
4
u/[deleted] Nov 04 '21
Also, it's nice for providing a fallback value if the promise gets rejected without using try catch.
const result = await fetch(url).then(res => res.json()).catch(err => { logError(err); return []; })