diff --git a/ierrors/ierrors_no_stacktrace.go b/ierrors/ierrors_no_stacktrace.go index 85890779..a9e792d7 100644 --- a/ierrors/ierrors_no_stacktrace.go +++ b/ierrors/ierrors_no_stacktrace.go @@ -19,12 +19,12 @@ func Join(errs ...error) error { return errors.Join(errs...) } -// Merge merges multiple errors into a single error by wrapping them. +// Chain chains multiple errors into a single error by wrapping them. // Any nil error values are discarded. -// Merge returns nil if every value in errs is nil. -// Merge adds a stacktrace to the error if there was no stacktrace +// Chain returns nil if every value in errs is nil. +// Chain adds a stacktrace to the error if there was no stacktrace // in the error tree yet and if the build flag "stacktrace" is set. -func Merge(errs ...error) error { +func Chain(errs ...error) error { var result error for _, err := range errs { if err == nil { diff --git a/ierrors/ierrors_stacktrace.go b/ierrors/ierrors_stacktrace.go index de7364da..49b67bea 100644 --- a/ierrors/ierrors_stacktrace.go +++ b/ierrors/ierrors_stacktrace.go @@ -82,12 +82,12 @@ func Join(errs ...error) error { return ensureStacktraceUniqueness(errors.Join(errs...)) } -// Merge merges multiple errors into a single error by wrapping them. +// Chain chains multiple errors into a single error by wrapping them. // Any nil error values are discarded. -// Merge returns nil if every value in errs is nil. -// Merge adds a stacktrace to the error if there was no stacktrace +// Chain returns nil if every value in errs is nil. +// Chain adds a stacktrace to the error if there was no stacktrace // in the error tree yet and if the build flag "stacktrace" is set. -func Merge(errs ...error) error { +func Chain(errs ...error) error { var result error for _, err := range errs { if err == nil { diff --git a/ierrors/ierrors_stacktrace_test.go b/ierrors/ierrors_stacktrace_test.go index acebba9d..c97b52cc 100644 --- a/ierrors/ierrors_stacktrace_test.go +++ b/ierrors/ierrors_stacktrace_test.go @@ -64,6 +64,6 @@ func TestErrors(t *testing.T) { err15 := WithStack(errStacktrace) require.Equal(t, 1, strings.Count(err15.Error(), "github.com/iotaledger/hive.go/ierrors.TestErrors")) - err16 := Merge(New("err16"), New("merged")) + err16 := Chain(New("err16"), New("chained")) require.Equal(t, 1, strings.Count(err16.Error(), "github.com/iotaledger/hive.go/ierrors.TestErrors")) }