errors

package module
v2.0.1 Latest Latest
Warning

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

Go to latest
Published: May 4, 2021 License: MIT Imports: 4 Imported by: 15

Documentation

Overview

Package errors.

This package can be used as drop-in replacement for https://golang.org/pkg/errors package.

This package provide StackTrace function to get the stack trace, use Wrap to make sure the error have stack trace

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func As

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

see https://golang.org/pkg/errors/#As

func Errorf

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

see https://golang.org/pkg/fmt/#Errorf

func Format

func Format(err error) string

Format representation of the Error, including stack trace.

Use err.Error() if you want to get just the error string

func Is

func Is(err, target error) bool

see https://golang.org/pkg/errors/#Is

func NewWithCause

func NewWithCause(text string, cause error) error

like New, but you can specify the cause error

func ParentStackTrace added in v2.0.1

func ParentStackTrace(err error) []trace.Location

Get stack trace of parent go routine of the error, return nil if none

func Spawn added in v2.0.1

func Spawn(f func() error) <-chan error

Spawn new go routine

run f, if f panic or returning non-nil error, it will be passed to the error channel

the error passed to the error chanel will return non-nil when passed to ParentStackTrace

func StackTrace

func StackTrace(err error) []trace.Location

Get stack trace of where the error is generated or wrapped, return nil if none

func Wrap

func Wrap(err error) error

Wrap the err if the err doens't have stack trace

Types

This section is empty.

Directories

Path Synopsis
Package trace provide utility to get stack trace.
Package trace provide utility to get stack trace.

Jump to

Keyboard shortcuts

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