-
Notifications
You must be signed in to change notification settings - Fork 77
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
Allow to unwrap joined errors #858
Conversation
To support logic of processing inner errors
Codecov ReportAll modified and coverable lines are covered by tests ✅
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## master #858 +/- ##
==========================================
+ Coverage 66.25% 66.84% +0.59%
==========================================
Files 253 255 +2
Lines 24004 24245 +241
==========================================
+ Hits 15903 16206 +303
+ Misses 7267 7209 -58
+ Partials 834 830 -4
Flags with carried forward coverage won't be shown. Click here to find out more.
☔ View full report in Codecov by Sentry. |
CHANGELOG.md
Outdated
@@ -1,3 +1,4 @@ | |||
* Allow to Unwrap joined errors (internal/xerrors/join.go `joinError.Unwrap() []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.
No need to add a line into CHANGELOG for internal refactorings
@@ -43,3 +43,8 @@ func (errs joinError) Is(target error) bool { | |||
} | |||
return false | |||
} | |||
|
|||
func (errs joinError) Unwrap() []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.
can you add a small test for this feature?
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.
You can add file join_go1.20_test.go with build tags
//go:build go1.20
// +build go1.20
for testing true behaviour with standard package errors
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.
test added.
@asmyasnikov , any updates? |
To support logic of processing inner errors
I hereby agree to the terms of the CLA available at: https://yandex.ru/legal/cla/?lang=en
Pull request type
Please check the type of change your PR introduces:
What is the current behavior?
It is unable to enumerate inner errors without reflection.
Issue Number: N/A
What is the new behavior?
You can cast
joinError
to standardinterface {Unwrap()[] error}
And work with inner errors.