errstack

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package errstack provides utilities to manage error stack traces.

Example
err := errors.New("error")
err = Wrap(err)
fmt.Println(err)
sfs := Frames(err)
fmt.Println(len(sfs))
Output:
error
2

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Ensure

func Ensure(err error) error

Ensure adds a stack to an error if it does not already have one.

func EnsureSkip

func EnsureSkip(err error, skip int) error

EnsureSkip adds a stack to an error if it does not already have one, skipping the given number of frames.

func Frames

func Frames(err error) []*runtime.Frames

Frames returns the list of runtime.Frames associated to an error.

See https://pkg.go.dev/runtime#Frames .

func Wrap

func Wrap(err error) error

Wrap adds a stack to an error.

The verbose message contains the stack.

See https://pkg.go.dev/runtime#Frames .

func WrapSkip

func WrapSkip(err error, skip int) error

WrapSkip adds a stack to an error, skipping the given number of frames.

See Wrap().

Types

This section is empty.

Jump to

Keyboard shortcuts

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