feat: add typed error message templates and stable replay snapshots
This commit is contained in:
@@ -314,11 +314,14 @@ func (c *Context) ResolveError(err error) *apierrors.APIError {
|
||||
// RecordError preserves failure semantics when a middleware commits buffered bytes.
|
||||
func (c *Context) RecordError(err error) { c.failure = c.ResolveError(err) }
|
||||
|
||||
// RecordFailure propagates an already resolved failure without reapplying a
|
||||
// different parent/catalog policy. Used with committed or buffered responses.
|
||||
func (c *Context) RecordFailure(err *apierrors.APIError) { c.failure = err.Clone() }
|
||||
|
||||
// Failure returns a detached description of a failure already handled by Context.
|
||||
func (c *Context) Failure() *apierrors.APIError {
|
||||
if c.failure == nil {
|
||||
return nil
|
||||
}
|
||||
copy := *c.failure
|
||||
return ©
|
||||
return c.failure.Clone()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user