werror

package
v0.10.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 23, 2026 License: MPL-2.0 Imports: 4 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Breadcrumbs(err error) []string

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.

func Wrap

func Wrap(err error, format string, args ...any) error

Wrap returns err with one named breadcrumb frame added, or nil when err is nil. The frame message is the formatted text. errors.Is and errors.As see through the frame.

Types

type WindsorError

type WindsorError struct {
	Message     string
	Remediation string
	Cause       error
}

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL