errors

package
v2.7.1 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2021 License: MIT Imports: 2 Imported by: 104

README

errors

Better error handling. Marries go-errors/errors to pkg/errors, and adds a little bit of our own magic sauce.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Base

func Base(format string, a ...interface{}) error

Base returns a simple error with no stack trace attached

func Err

func Err(err interface{}, fmtParams ...interface{}) error

Err intelligently creates/handles errors, while preserving the stack trace. It works with errors from github.com/pkg/errors too.

func FullTrace

func FullTrace(err error) string

FullTrace returns the error type, message, and stack trace

func HasTrace

func HasTrace(err error) bool

HasTrace checks if error has a trace attached

func Is

func Is(e error, original error) bool

Is compares two wrapped errors to determine if the underlying errors are the same It also interops with errors from pkg/errors

func Prefix

func Prefix(prefix string, err interface{}) error

Prefix prefixes the message of the error with the given string

func Trace

func Trace(err error) string

Trace returns the stack trace

func Unwrap

func Unwrap(err error) error

Unwrap returns the original error that was wrapped

func Wrap

func Wrap(err interface{}, skip int) *errors.Error

Wrap calls errors.Wrap, in case you want to skip a different amount

Types

This section is empty.

Jump to

Keyboard shortcuts

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