Files
contracts/errs/contextual_error.go
T

13 lines
592 B
Go
Raw Normal View History

package errs
// ContextualError is implemented by errors that expose structured key-value context
// fields. The core starter's Logger implementation consumes this interface to append
// context fields to structured log records. The core starter's xerrors implementation
// satisfies it via its ErrorContext method.
type ContextualError interface {
// ErrorContext returns a map of structured fields attached to this error.
// Keys are strings; values may be any type representable in a log record.
// The returned map must not be modified by the caller.
ErrorContext() map[string]any
}