Skip to content

feat: flatten errors.Join results in Combine/Append - #86

Open
sonnemusk wants to merge 1 commit into
uber-go:masterfrom
sonnemusk:feat/flatten-errors-join
Open

feat: flatten errors.Join results in Combine/Append#86
sonnemusk wants to merge 1 commit into
uber-go:masterfrom
sonnemusk:feat/flatten-errors-join

Conversation

@sonnemusk

Copy link
Copy Markdown

What

Combine / Append flatten values that implement the multi-error Unwrap() []error interface (including errors.Join from Go 1.20+), the same way nested multierr values are already flattened.

Why

multierr.Combine(errors.Join(a, b), c) previously kept the join as a single nested error. Callers using both packages expect a flat list for Errors / errors.Is.

Test

  • TestCombineFlattensErrorsJoin

errors.Join implements the multi-error Unwrap interface. Treat those
the same as nested multierr values so Combine(errors.Join(a,b), c)
yields a flat list of a, b, c.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant