stackerr

package
v0.0.0-...-264c737 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultCap = 15

DefaultCap is a default cap for frames array. It can be changed to number of expected frames for purpose of performance optimisation.

Functions

func ZapFields

func ZapFields(err error) []zapcore.Field

Types

type Frame

type Frame struct {
	// Path contains a file path.
	Path string
	// Line contains a line number.
	Line int
}

Frame is a single step in stack trace.

func StackTrace

func StackTrace(err error) []Frame

StackTrace returns stack trace of an error. It will be empty if err is not of type Error.

func (Frame) String

func (f Frame) String() string

String formats Frame to string.

type Stakerr

type Stakerr interface {
	Error() string
	StackTrace() []Frame
	Unwrap() error
}

Stakerr is an error with stack trace.

func New

func New(message string) Stakerr

New creates new error with stacktrace.

func Wrap

func Wrap(err error, message string) Stakerr

Wrap adds stacktrace to existing error.

Jump to

Keyboard shortcuts

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