errwrap

package module
v0.0.0-...-f6139e6 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2026 License: MIT Imports: 2 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

Overview

Package errwrap wraps errors with additional context and walks chains of wrapped errors.

This is a yoke clean-room implementation written for S488.3c (remove the MPL-2.0 hashicorp/errwrap dependency from the engine build). Nothing in the yoke engine graph imports errwrap directly — it was only reached through go-multierror, which this repository now replaces with external/multierror. The module exists so the hashicorp/errwrap module path resolves to permissive code for consumers that pin it alongside the multierror replacement. The surface is the small wrapping/walking core, designed from the standard library error-wrapping conventions (fmt.Errorf with %w, errors.Is/As traversal); the replaced module's source was never read.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Get

func Get(err, target error) error

Get returns the first error in err's chain that is equal to target (per errors.Is), or nil when there is no match.

func GetAll

func GetAll(err, target error) []error

GetAll returns every error in err's chain that is equal to target (per errors.Is).

func Walk

func Walk(err error, fn func(error) error) error

Walk descends err through its Unwrap chain (both the single-error and []error forms), calling fn for err itself and every wrapped error beneath it. It stops descending a branch once fn returns false, and returns the first error fn itself returns, if any.

func Wrap

func Wrap(cause error, msg string) error

Wrap returns an error that adds context to cause, formatted as "<msg>: <cause>". A nil cause returns nil.

func Wrapf

func Wrapf(cause error, format string, args ...any) error

Wrapf is Wrap with fmt.Sprintf formatting for the message.

Types

This section is empty.

Jump to

Keyboard shortcuts

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