errortrace

package
v2.9.0-dev Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2026 License: Apache-2.0, BSD-3-Clause, Apache-2.0 Imports: 6 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, skip uint) *TracerError

WrapN takes in an error and records the stack trace at the moment that it was thrown. Note: The n parameter is ignored; internal/stacktrace uses its own default depth. The skip parameter specifies how many stack frames to skip before capturing.

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. Uses the centralized internal/stacktrace formatting.

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