fix: inherit App error catalogs on generated routes without local errors

This commit is contained in:
2026-09-24 15:42:03 +08:00
parent bca2ef92cc
commit a2a07a39ea
21 changed files with 570 additions and 54 deletions

View File

@@ -299,7 +299,8 @@ func (c *Context) WriteError(err error) {
}
// SetErrorRegistry sets an application fallback. Route encoders can supply their
// own registry; clones retain both policies without any process-global lookup.
// own nonempty registry; an encoder without a registry inherits this fallback.
// Clones retain both policies without any process-global lookup.
func (c *Context) SetErrorRegistry(r *apierrors.Registry) { c.errorRegistry = r }
func (c *Context) ResolveError(err error) *apierrors.APIError {
registry := c.errorRegistry