MCPcopy Index your code
hub / github.com/cockroachdb/errors / Join

Function Join

join/join.go:32–51  ·  view source on GitHub ↗

Join returns an error that wraps the given errors. Any nil error values are discarded. Join returns nil if errs contains no non-nil values. The error formats as the concatenation of the strings obtained by calling the Error method of each element of errs, with a newline between each string.

(errs ...error)

Source from the content-addressed store, hash-verified

30// by calling the Error method of each element of errs, with a newline
31// between each string.
32func Join(errs ...error) error {
33 n := 0
34 for _, err := range errs {
35 if err != nil {
36 n++
37 }
38 }
39 if n == 0 {
40 return nil
41 }
42 e := &joinError{
43 errs: make([]error, 0, n),
44 }
45 for _, err := range errs {
46 if err != nil {
47 e.errs = append(e.errs, err)
48 }
49 }
50 return e
51}
52
53type joinError struct {
54 errs []error

Callers 4

JoinWithDepthFunction · 0.92
datadriven_test.goFile · 0.92
TestJoinFunction · 0.70
initFunction · 0.70

Calls

no outgoing calls

Tested by 1

TestJoinFunction · 0.56

Used in the wild real call sites across dependent graphs

searching dependent graphs…