errortrace

package
v2.3.0-dev Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2025 License: Apache-2.0, BSD-3-Clause, Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type TracerError

type TracerError struct {
	// contains filtered or unexported fields
}

TracerError is an error type that holds stackframes from when the error was thrown. It can be used interchangeably with the built-in Go error type.

func Errorf

func Errorf(format string, a ...any) *TracerError

Errorf serves the same purpose as fmt.Errorf, but returns a TracerError and prevents wrapping errors of type TracerError twice. The %w flag will only wrap errors if they are not already of type *TracerError.

func New

func New(text string) *TracerError

func Wrap

func Wrap(err error) *TracerError

Wrap takes in an error and records the stack trace at the moment that it was thrown.

func WrapN

func WrapN(err error, n uint, skip uint) *TracerError

WrapN takes in an error and records the stack trace at the moment that it was thrown. It will capture a maximum of `n` entries, skipping the first `skip` entries. If n is 0, it will capture up to 32 entries instead.

func (*TracerError) Error

func (err *TracerError) Error() string

func (*TracerError) Format

func (err *TracerError) Format() string

Format returns a string representation of the stack trace.

func (*TracerError) Unwrap

func (err *TracerError) Unwrap() error

Unwrap takes a wrapped error and returns the inner error.

Jump to

Keyboard shortcuts

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