Skip to content

lib/errors: spike improving formatting of nested multi-errors

Created by: bobheadxi

Nested multi-errors format poorly as of https://github.com/sourcegraph/sourcegraph/pull/31466#discussion_r810135022:

fmt.Sprintf("%s", Append(Wrap(Append(errFoo, errBar), "hello world"), errBaz))

will print something like:

        (1) 2 errors occurred:
          |     * hello world: 2 errors occurred:
          |     * foo
          |     * bar
          |     * baz

We could add some depth information to multiError to generate indentation levels, but we need to be careful how that works with Unwrap, As, etc.