Skip to content

Fix: unwrap joined errors#4632

Closed
odlev wants to merge 6 commits intogin-gonic:masterfrom
odlev:fix/unwrap-joined-errors
Closed

Fix: unwrap joined errors#4632
odlev wants to merge 6 commits intogin-gonic:masterfrom
odlev:fix/unwrap-joined-errors

Conversation

@odlev
Copy link
Copy Markdown

@odlev odlev commented Apr 15, 2026

Pull Request Checklist

  • Open your pull request against the master branch.
  • All tests pass in available continuous integration systems (e.g., GitHub Actions).
  • Tests are added or modified as needed to cover code changes.
  • If the pull request introduces a new feature, the feature is documented in the docs/doc.md.

Description

Context.Error() now unwraps errors created by errors.Join() — each
inner error gets its own entry in c.Errors instead of being stored as a
single opaque multi-error.

Before:

Error #01: gin error
Error #02: service error
store error
Error #03: other error

After:

Error #01: gin error
Error #02: service error
Error #03: store error
Error #04: other error

The unwrap is recursive, so nested joins work too.
If a joined error contains a *gin.Error, its Type and Meta are preserved.
Empty Unwrap() slices fall through to the normal path.

Added 3 tests: basic join, nested join, join with typed *gin.Error.

Fixes #4237 - #4237

Copilot AI and others added 6 commits April 7, 2026 20:37
Only apply os.Chmod to directories newly created by os.MkdirAll.
Previously, chmod was called unconditionally, which broke saving
files into pre-existing directories not owned by the process
(e.g., /tmp) with "operation not permitted" error.

Refs gin-gonic#4622

Agent-Logs-Url: https://github.com/odlev/gin/sessions/2d0f57ad-a46e-45f6-a2f2-b6d4c352f22e

Co-authored-by: odlev <65655276+odlev@users.noreply.github.com>
fix: safe type assertions in Hijack and CloseNotify to prevent panics
@odlev odlev closed this Apr 15, 2026
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()

2 participants