Skip to content

tlog-dev/errors

Repository files navigation

Documentation Go workflow CircleCI codecov Go Report Card GitHub tag (latest SemVer)

errors

errors is a wrapper around the standard errors.New and fmt.Errorf functions. It unifies their APIs, allowing you to create new errors or wrap existing ones with rich context (formatted message with arguments).

It provides two core functions:

errors.New(format string, args ...any) error
errors.Wrap(err error, format string, args ...any) error

While it previously had more features, I eventually realized that, in most cases, anything beyond simple error wrapping is an overcomplication.