package errwrap
import "github.com/purpleidea/mgmt/util/errwrap"
Package errwrap contains some error helpers.
Index ¶
- func Append(reterr, err error) error
- func String(err error) string
- func Wrapf(err error, format string, args ...interface{}) error
Functions ¶
func Append ¶
Append can be used to safely append an error onto an existing one. If you pass in a nil error to append, the existing error will be returned unchanged. If the existing error is already nil, then the new error will be returned unchanged. This makes it easy to use Append as a safe `reterr += err`, when you don't know if either is nil or not.
func String ¶
String returns a string representation of the error. In particular, if the error is nil, it returns an empty string instead of panicking.
func Wrapf ¶
Wrapf adds a new error onto an existing chain of errors. If the new error to be added is nil, then the old error is returned unchanged.
Source Files ¶
- Version
- v0.0.0-20250322185616-c50a578426f1 (latest)
- Published
- Mar 22, 2025
- Platform
- linux/amd64
- Imports
- 2 packages
- Last checked
- 4 days ago –
Tools for package owners.