errutil

package
v1.2.3-hotfix-20240916 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContextWithNoReport added in v0.7.0

func ContextWithNoReport(parent context.Context, no bool) context.Context

func GetReportErrorFunc

func GetReportErrorFunc() reportErrorFunc

func HasContext

func HasContext(err error) bool

func HasStack

func HasStack(err error) bool

func NoReportFromContext added in v0.7.0

func NoReportFromContext(ctx context.Context) bool

NoReportFromContext return false default.

func ReportError

func ReportError(ctx context.Context, err error)

ReportError used to handle non-moerr Error

func SetErrorReporter

func SetErrorReporter(f reportErrorFunc)

func WalkDeep

func WalkDeep(err error, visitor func(err error) bool) bool

WalkDeep does a depth-first traversal of all errors. The visitor function can return true to end the traversal early, otherwise false.

func WithContext

func WithContext(ctx context.Context, err error) error

WithContext annotates err with a stack info and a context, which should contain span info. At the mean time, it will call ReportError to store error info If err is nil, WithContext returns nil.

func WithContextWithDepth

func WithContextWithDepth(ctx context.Context, err error, depth int) error

func Wrap

func Wrap(err error, message string) error

func Wrapf

func Wrapf(err error, format string, args ...any) error

Types

type ContextTracer

type ContextTracer interface {
	Context() context.Context
}

ContextTracer retrieves the context.Context

func GetContextTracer

func GetContextTracer(inErr error) ContextTracer

type StackTracer

type StackTracer interface {
	StackTrace() stack.StackTrace
}

StackTracer retrieves the StackTrace Generally you would want to use the GetStackTracer function to do that.

func GetStackTracer

func GetStackTracer(inErr error) StackTracer

type WithIs

type WithIs interface {
	Is(error) bool
}

type Wrapper

type Wrapper interface {
	Unwrap() error
}

Jump to

Keyboard shortcuts

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