mirror of
https://github.com/m1k1o/neko.git
synced 2024-07-24 14:40:50 +12:00
23 lines
277 B
Go
23 lines
277 B
Go
|
package utils
|
||
|
|
||
|
import "fmt"
|
||
|
|
||
|
func ErrorsJoin(errs []error) error {
|
||
|
var resErr error
|
||
|
|
||
|
for _, err := range errs {
|
||
|
if err == nil {
|
||
|
continue
|
||
|
}
|
||
|
|
||
|
if resErr == nil {
|
||
|
resErr = err
|
||
|
continue
|
||
|
}
|
||
|
|
||
|
resErr = fmt.Errorf("%w; %s", resErr, err.Error())
|
||
|
}
|
||
|
|
||
|
return resErr
|
||
|
}
|