refactor(roxerror): Make CausedBy use double %w semantics#19501
refactor(roxerror): Make CausedBy use double %w semantics#19501
Conversation
|
This change is part of the following stack: Change managed by git-spice. |
|
Skipping CI for Draft Pull Request. |
|
Images are ready for the commit at b7eccd8. To use with deploy scripts, first |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #19501 +/- ##
==========================================
- Coverage 49.27% 49.26% -0.01%
==========================================
Files 2726 2726
Lines 205625 205628 +3
==========================================
- Hits 101318 101312 -6
- Misses 96773 96779 +6
- Partials 7534 7537 +3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
@vikin91: The following test failed, say
Full PR test history. Your PR dashboard. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
Description
Update
errox.RoxError.CausedByto preserve error causes in the unwrap chain when the provided cause is anerror.Before this change,
CausedByusedfmt.Errorf("%w: %v", e, cause), soerrors.Is(err, cause)was always false for error causes.After this change,
CausedByusesfmt.Errorf("%w: %w", e, causeErr)whencauseis anerror, so callers can match both the RoxError class and the underlying cause viaerrors.Is.For non-error causes, behavior remains unchanged (
fmt.Errorf("%w: %v", e, cause)), keeping message formatting and existing semantics for string/typed values.User-facing documentation
Testing and quality
Automated testing
How I validated my change