package errs
import "github.com/zeebo/errs"
Package errs provides a simple error package with stack traces.
Index ¶
- func New(format string, args ...interface{}) error
- func Unwrap(err error) error
- func Wrap(err error) error
- type Class
Functions ¶
func New ¶
New returns an error not contained in any class. This is the same as calling fmt.Errorf(...) except it captures a stack trace on creation.
func Unwrap ¶
Unwrap returns the underlying error, if any, or just the error. It returns nil if any error claims it was caused by nil.
func Wrap ¶
Wrap returns an error not contained in any class. It just associates a stack trace with the error.
Types ¶
type Class ¶
type Class string
Class represents a class of errors. You can construct errors, and check if errors are part of the class.
func Classes ¶
Classes returns all the classes that have wrapped the error.
func (*Class) Has ¶
Has returns true if the passed in error was wrapped by this class.
func (*Class) New ¶
New constructs an error with the format string that will be contained by this class. This is the same as calling Wrap(fmt.Errorf(...)).
func (*Class) Wrap ¶
Wrap returns a new error based on the passed in error that is contained in this class.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
errdata | Package errdata helps with associating some data to error classes |
- Version
- v0.1.0
- Published
- Feb 16, 2018
- Platform
- js/wasm
- Imports
- 3 packages
- Last checked
- 1 week ago –
Tools for package owners.