-
Notifications
You must be signed in to change notification settings - Fork 397
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
feat(examples): add p/moul/errs #3926
base: master
Are you sure you want to change the base?
Conversation
Signed-off-by: moul <[email protected]>
🛠 PR Checks SummaryAll Automated Checks passed. ✅ Manual Checks (for Reviewers):
Read More🤖 This bot helps streamline PR reviews by verifying automated checks and providing guidance for contributors and reviewers. ✅ Automated Checks (for Contributors):🟢 Maintainers must be able to edit this pull request (more info) ☑️ Contributor Actions:
☑️ Reviewer Actions:
📚 Resources:Debug
|
|
||
// Errors returns the slice of underlying errors contained in this multiError. | ||
// Returns nil if the receiver is nil. | ||
func (m *multiError) Errors() []error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unwrap() []error
?
We don't have the extra functions in errors
, but I think we should in the future, post-reflection
// Combine merges multiple errors into a single error efficiently. | ||
// It handles several cases: | ||
// - If all input errors are nil, returns nil | ||
// - If there's exactly one non-nil error, returns that error directly | ||
// - If there are multiple non-nil errors, returns a multiError containing them | ||
func Combine(errs ...error) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you not remove Append
, and instead handle the case in this function where the err.(*multiErr)
in the range?
Based on https://go.uber.org/multierr which is my favorite multi-error library in go.