errors

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2020 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package errors augments the standard errors provided by fmt (https://golang.org/src/fmt/errors.go) with a Wrap() method to wrap errors without resorting to fmt.Errorf("%w", err).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func As

func As(err error, target interface{}) bool

As finds the first error in err's chain that matches target, and if so, sets target to that error value and returns true. (a shortcut to standard lib errors.As)

func Is

func Is(err, target error) bool

Is reports whether any error in err's chain matches target (a shortcut to standard lib errors.As)

Types

type Error

type Error struct {
	// contains filtered or unexported fields
}

Error augments the standard error interface with a Wrap method.

The main difference with github.com/pkg/errors is that we are wrapping errors from errors, not from text.

func New

func New(msg string) *Error

New Error

func (*Error) Error

func (e *Error) Error() string

Error message

func (*Error) Is

func (e *Error) Is(target error) bool

Is of some error type?

func (*Error) Unwrap

func (e *Error) Unwrap() error

Unwrap nested error

func (*Error) Wrap

func (e *Error) Wrap(err error) *Error

Wrap a nested error

Jump to

Keyboard shortcuts

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