From 930bb9c839556f2cd25925e05054fda23d83861d Mon Sep 17 00:00:00 2001 From: dudaodong Date: Thu, 16 Mar 2023 15:59:06 +0800 Subject: [PATCH] feat: complete promise Any function --- async/promise.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/async/promise.go b/async/promise.go index 8664ef5..a03378a 100644 --- a/async/promise.go +++ b/async/promise.go @@ -8,6 +8,8 @@ import ( "errors" "fmt" "sync" + + "github.com/duke-git/lancet/v2/internal" ) // Promise represents the eventual completion (or failure) of an asynchronous operation and its resulting value. @@ -267,9 +269,10 @@ func Any[T any](promises ...*Promise[T]) *Promise[T] { } errCombo := errs[0] - // for _, err := range errs[1:] { - // errCombo = errors. - // } + for _, err := range errs[1:] { + errCombo = internal.JoinError(err) + } + reject(errCombo) }) }