Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support other multierr implementations #12

Open
abhinav opened this issue Jun 1, 2017 · 2 comments
Open

Support other multierr implementations #12

abhinav opened this issue Jun 1, 2017 · 2 comments

Comments

@abhinav
Copy link
Collaborator

abhinav commented Jun 1, 2017

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.

@akshayjshah
Copy link

We can do this via the unexported errorGroup interface now, correct?

@abhinav
Copy link
Collaborator Author

abhinav commented Jul 5, 2017

Yeah, we can implement this with the errorGroup interface. We'll want to
keep the existing fast path implementation where the error is a *multiError
and add a slow copy-based path for errorGroups.

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

No branches or pull requests

2 participants