errstack

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2025 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 := slices.Collect(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) iter.Seq[iter.Seq[runtime.Frame]]

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

func Wrap

func Wrap(err error) error

Wrap adds a stack to an error.

The verbose message contains the stack.

See runtime.Frames.

func WrapSkip

func WrapSkip(err error, skip int) error

WrapSkip calls Wrap, skipping the given number of frames.

Types

This section is empty.

Jump to

Keyboard shortcuts

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