Skip to content

Conversation

ronenh
Copy link
Contributor

@ronenh ronenh commented Feb 20, 2025

When adding an inner error using .Err(err) we "merge" the data fields from the inner error to the outer and in the process may overwrite the fields of the outer error, including the msg field.
There is no reason to do that. The inner error's data fields remain in the inner error and get formatted correctly when calling .Error() on the outer error.

@coveralls
Copy link

Pull Request Test Coverage Report for Build 13444376735

Details

  • 1 of 1 (100.0%) changed or added relevant line in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.2%) to 65.886%

Totals Coverage Status
Change from base Build 13418861578: 0.2%
Covered Lines: 197
Relevant Lines: 299

💛 - Coveralls

@ronenh ronenh changed the title Don't overwrite data from inner errors Don't overwrite data fields from inner errors Feb 20, 2025
@gertd gertd merged commit 4ceb28a into main Feb 21, 2025
3 checks passed
@gertd gertd deleted the inner-errors branch February 21, 2025 00:51
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

Successfully merging this pull request may close these issues.

3 participants