Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Breadcrumbs ¶
Breadcrumbs returns one message per Wrap frame and WindsorError in the chain, outermost first. It ends with the text of the innermost error when that error is neither a frame nor a WindsorError. Intermediate fmt.Errorf wraps add no entry, because their text repeats the chain. Each entry has no surrounding whitespace. A message that ends the previous entry adds no entry.
Types ¶
type WindsorError ¶
WindsorError is an error with a user-facing message and a remediation.
func Find ¶
func Find(err error) *WindsorError
Find returns the outermost WindsorError in the single-cause chain of err, or nil when there is none. It does not look inside an error that joins several causes, such as one from errors.Join, because the message of one cause would then hide the others.
func New ¶
func New(message, remediation string, cause error) *WindsorError
New returns a WindsorError. Cause may be nil when the error starts a new condition.
func (*WindsorError) Error ¶
func (e *WindsorError) Error() string
Error returns the user-facing message without the cause.
func (*WindsorError) LogValue ¶
func (e *WindsorError) LogValue() slog.Value
LogValue returns the message and remediation as structured log attributes.
func (*WindsorError) Unwrap ¶
func (e *WindsorError) Unwrap() error
Unwrap returns the wrapped cause.