Promises: Error Handling, Aborts, and Helper Methods - Part 2
Vložit
- čas přidán 28. 07. 2024
- We're diving into part 2 of our 3-part series on Promises, focusing on error handling, aborts, and essential helper methods. We'll explore how to manage errors effectively and improve performance with abort signals. Let's get into it!
Show Notes
00:00 Welcome to Syntax!
00:41 Brought to you by Sentry.io.
02:00 Cancelling promises.
05:16 Why would you reach for an abort signal?
06:26 Promise helpers.
07:04 Promise.all() vs Promise.allSettled().
09:12 promiseInstance.finally()
09:26 Promise.any() and Promise.race()
12:08 Error handling strategies.
17:30 Promise.race() example.
18:54 Static Promise.reject() and .resolve() methods.
All links available at syntax.fm/771
------------------------------------------------------------------------------
Hit us up on Socials!
Scott: / stolinski
Wes: / wesbos
Randy: / @randyrektor
Syntax: / syntaxfm
www.syntax.fm
Brought to you by Sentry.io
#webdevelopment #webdeveloper #javascript - Věda a technologie
Great as always.
I know you want to keep the show effective for audio only but some code examples on the screen would be really helpful.
We have a few recorded all ready with code on screen. Def something we'll be doing much more in the future
Promise.race is useful for hitting both an external API and a cache, you trigger both and wait for the fastest successful response.
makes so much sense lol thank you for that
Another example usage of Promise.race would be for a large scale system with some sort of redundant services you want data and you know you can get it from multiple points so you do multiple fetches resolving to the same mapper from different sources.
Promise {} 😊
Sentry swag drop when?!!
🐫
Promise.race in a sorta Family Feud game with webhooks. First player to hit their button gets to answer.