errutils

package
v0.2.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ErrStack

func ErrStack(err error) []byte

ErrStack takes in an error and returns the stack trace in a byte slice. Go errors don't natural keep track of stack info, but the pkg/errors package does, so we pull the stack trace using that info.

func Fatal

func Fatal(err error)

Fatal prints an error, prints its stack trace, and then exits with a 1 exit code.

func UnwrapErr

func UnwrapErr(err error) error

UnwrapErr takes in an error, goes through the error cause chain, and returns the deepest error that has a stacktrace. This is needed because by default, every subsequent call to errors.Wrap overwrites the previous stacktrace. So in the end, we don't know where the error originated from. By going to the deepest one, we can find exactly where it started.

Types

This section is empty.

Jump to

Keyboard shortcuts

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