
·9 min read
Stop Using Promise.race for Fallbacks: The Case for Promise.any and AggregateError
Promise.any short-circuits on success and collects failures in AggregateError - the exact opposite of Promise.all, and surprisingly useful in practice.
Stories, tutorials, and deep dives spanning across diverse worlds.

Promise.any short-circuits on success and collects failures in AggregateError - the exact opposite of Promise.all, and surprisingly useful in practice.

Promise.anyは成功時にショートサーキットし、失敗をAggregateErrorに集約します。これはPromise.allとは正反対の動作で、実用上驚くほど便利です。

Promise.any dừng ngay khi thành công và thu thập các lỗi vào AggregateError - hoàn toàn ngược lại với Promise.all, và hữu ích đáng ngạc nhiên trong thực tế.