MCPcopy
hub / github.com/duke-git/lancet / JoinError

Function JoinError

internal/error_join.go:13–32  ·  view source on GitHub ↗

Note: this file is copyed from the go standart repo (https://github.com/golang/go/blob/master/src/errors/join.go). just in order to adapt under go1.9 do not use it outside lancet lib. Join returns an error that wraps the given errors. Any nil error values are discarded. Join returns nil if errs cont

(errs ...error)

Source from the content-addressed store, hash-verified

11// by calling the Error method of each element of errs, with a newline
12// between each string.
13func JoinError(errs ...error) error {
14 n := 0
15 for _, err := range errs {
16 if err != nil {
17 n++
18 }
19 }
20 if n == 0 {
21 return nil
22 }
23 e := &joinError{
24 errs: make([]error, 0, n),
25 }
26 for _, err := range errs {
27 if err != nil {
28 e.errs = append(e.errs, err)
29 }
30 }
31 return e
32}
33
34type joinError struct {
35 errs []error

Callers 5

ExampleCatchFunction · 0.92
ExamplePromise_CatchFunction · 0.92
TestCatchFunction · 0.92
TestPromise_CatchFunction · 0.92
AnyFunction · 0.92

Calls

no outgoing calls

Tested by 4

ExampleCatchFunction · 0.74
ExamplePromise_CatchFunction · 0.74
TestCatchFunction · 0.74
TestPromise_CatchFunction · 0.74

Used in the wild real call sites across dependent graphs

searching dependent graphs…