internal

package
v1.4.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func TraverseErr added in v1.3.1

func TraverseErr(err error, fn func(error) (ok bool)) (ok bool)

TraverseErr traverses the err error chain until fn returns true. Traversal stops on nil errors, fn(nil) is never called. Returns true if fn matched, false otherwise.

Types

type FrameCursor

type FrameCursor struct {
	// Current specifies the current stack frame.
	// if omitted, rest contains the complete stack
	Current *runtime.Frame
	// Rest specifies the rest of stack frames to explore
	Rest *runtime.Frames
	// N specifies the total number of stack frames
	N int
}

FrameCursor stores the position in a call stack

type Trace

type Trace struct {
	// Path is a full file path
	Path string `json:"path"`
	// Func is a function name
	Func string `json:"func"`
	// Line is a code line number
	Line int `json:"line"`
}

Trace stores structured trace entry, including file line and path

func (*Trace) String

func (t *Trace) String() string

String returns debug-friendly representation of this trace

type Traces

type Traces []Trace

Traces is a list of trace entries

func CaptureTraces

func CaptureTraces(skip int) Traces

CaptureTraces gets the current stack trace with some deep frames skipped

func GetTracesFromCursor

func GetTracesFromCursor(cursor FrameCursor) Traces

GetTracesFromCursor gets the current stack trace from a given cursor

func (Traces) Func

func (s Traces) Func() string

Func returns first function in trace list

func (Traces) FuncName

func (s Traces) FuncName() string

Func returns just function name

func (Traces) Loc

func (s Traces) Loc() string

Loc points to file/line location in the code

func (Traces) String

func (s Traces) String() string

String returns debug-friendly representaton of trace stack

Jump to

Keyboard shortcuts

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