Skip to content

fix: unwrap errors.Join() created joined errors in Context.Error()#4592

Open
larkwins wants to merge 2 commits intogin-gonic:masterfrom
larkwins:fix/4237-unwrap-join-errors
Open

fix: unwrap errors.Join() created joined errors in Context.Error()#4592
larkwins wants to merge 2 commits intogin-gonic:masterfrom
larkwins:fix/4237-unwrap-join-errors

Conversation

@larkwins
Copy link
Copy Markdown

Automatically unwrap errors created by errors.Join() when passed to
Context.Error(), so they are added as separate error entries instead
of a single combined error. This improves error log readability and
structure.

Before:
Error #1: gin error
Error #2: service error
store error
Error #3: other error

After:
Error #1: gin error
Error #2: service error
Error #3: store error
Error #4: other error

Closes #4237

willlv added 2 commits March 23, 2026 16:00
…in-gonic#4237)

Automatically unwrap errors created by errors.Join() when passed to
Context.Error(), so they are added as separate error entries instead
of a single combined error. This improves error log readability and
structure.

Before:
  Error gin-gonic#1: gin error
  Error gin-gonic#2: service error
  store error
  Error gin-gonic#3: other error

After:
  Error gin-gonic#1: gin error
  Error gin-gonic#2: service error
  Error gin-gonic#3: store error
  Error gin-gonic#4: other error

Closes gin-gonic#4237
- Add '_ =' to ignore return values of c.Error() calls in tests
- Add '_ =' to recursive c.Error() call in Context.Error()
- Run gofmt to fix formatting issues
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 23, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.37%. Comparing base (3dc1cd6) to head (e262534).
⚠️ Report is 275 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4592      +/-   ##
==========================================
- Coverage   99.21%   98.37%   -0.84%     
==========================================
  Files          42       48       +6     
  Lines        3182     3146      -36     
==========================================
- Hits         3157     3095      -62     
- Misses         17       42      +25     
- Partials        8        9       +1     
Flag Coverage Δ
?
--ldflags="-checklinkname=0" -tags sonic 98.36% <100.00%> (?)
-tags go_json 98.30% <100.00%> (?)
-tags nomsgpack 98.35% <100.00%> (?)
go-1.18 ?
go-1.19 ?
go-1.20 ?
go-1.21 ?
go-1.25 98.37% <100.00%> (?)
go-1.26 98.37% <100.00%> (?)
macos-latest 98.37% <100.00%> (-0.84%) ⬇️
ubuntu-latest 98.37% <100.00%> (-0.84%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

Unwrap joinErr in gin.Error()

1 participant