2min chapter

Syntax - Tasty Web Development Treats cover image

Code Styles: Readable Rules and Petty Preferences

Syntax - Tasty Web Development Treats

CHAPTER

The Promise Dot Catch Method

I just try catch really bums me out as much as I love a wait and a single wait having to really populate my code with a billion try catches. In most cases, I will just await a promise and throw a catch on the end, which is I call mix and match. One kind of cool thing I've seen some libraries do is they will return to you an object and you'll have your data and your error on that object. And like that to me, that's ideal because upfront, you're getting either its data or his error.

00:00

Get the Snipd
podcast app

Unlock the knowledge in podcasts with the podcast player of the future.
App store bannerPlay store banner

AI-powered
podcast player

Listen to all your favourite podcasts with AI-powered features

Discover
highlights

Listen to the best highlights from the podcasts you love and dive into the full episode

Save any
moment

Hear something you like? Tap your headphones to save it with AI-generated key takeaways

Share
& Export

Send highlights to Twitter, WhatsApp or export them to Notion, Readwise & more

AI-powered
podcast player

Listen to all your favourite podcasts with AI-powered features

Discover
highlights

Listen to the best highlights from the podcasts you love and dive into the full episode