We previously dropped support for integrating with error implementations which
expose the underlying list of errors via some interface like,
type MultiError interface {
Causes() []error
}
// Type and method name up for discussion
This issue is to discuss the possibility of adding something like that back
and implementing that interface on the library's error type.
Besides integrating with other libraries, this will allow multierr to be
compatible with other versions of the same library. That is, adding an
interface like this will allow us to handle the case where one repo is using
version A from foo/vendor/go.uber.org/multierr and another repo is using
version B from bar/vendor/go.uber.org/multierr. Error types returned by
version A will be compatible with Append calls in version B because they'll
both implement the MultiError interface.
Implementation detail: We'll still want to keep the optimization where the
error type matches *multiError exactly. We'll just add a fallback case for
the interface-version which will be a bit slower.
We previously dropped support for integrating with error implementations which
expose the underlying list of errors via some interface like,
This issue is to discuss the possibility of adding something like that back
and implementing that interface on the library's error type.
Besides integrating with other libraries, this will allow multierr to be
compatible with other versions of the same library. That is, adding an
interface like this will allow us to handle the case where one repo is using
version A from
foo/vendor/go.uber.org/multierrand another repo is usingversion B from
bar/vendor/go.uber.org/multierr. Error types returned byversion A will be compatible with Append calls in version B because they'll
both implement the
MultiErrorinterface.Implementation detail: We'll still want to keep the optimization where the
errortype matches*multiErrorexactly. We'll just add a fallback case forthe interface-version which will be a bit slower.