errwrap

package
v0.0.17 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2022 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package errwrap contains some error helpers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Append

func Append(reterr, err error) error

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 Cause added in v0.0.2

func Cause(err error) error

Cause returns the top-most error that we can print directly to the end-user.

func String

func String(err error) string

String returns a string representation of the error. In particular, if the error is nil, it returns an empty string instead of panicing.

func Wrapf

func Wrapf(err error, format string, args ...interface{}) error

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.

Types

This section is empty.

Jump to

Keyboard shortcuts

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