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.