โœจ Meet Promise.try()

A new static method that wraps any callback in a Promise - handling both sync and async execution uniformly.

Unlike Promise.resolve(), it catches synchronous errors and provides cleaner syntax for unified error handling.

Start experimenting now ๐Ÿ‘‡
developer.mozilla.org/en-US/do

0

If you have a fediverse account, you can quote this note from your own instance. Search https://mastodon.social/users/mdn/statuses/116126437170814879 on your instance and quote it. (Note that quoting is not supported in Mastodon.)