xerrors

package module
v0.0.0-...-6f0b6cc Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2024 License: MIT Imports: 6 Imported by: 78

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(msg string) error

New returns an error.

func NewWithStack

func NewWithStack(msg string) error

NewWithStack returns an error with a stack trace.

func Newf

func Newf(format string, a ...any) error

Newf returns an error with formatted text.

func NewfWithStack

func NewfWithStack(format string, a ...any) error

NewfWithStack returns an error with formatted text and a stack trace.

func WithMessage

func WithMessage(err error, msg string) error

func WithMessagef

func WithMessagef(err error, format string, a ...any) error

func WithStack

func WithStack(err error) error

WithStack annotates err with a stack trace. If err is nil, WithStack returns nil.

Types

type Error

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

func (*Error) Error

func (e *Error) Error() string

func (*Error) Format

func (e *Error) Format(s fmt.State, verb rune)

func (*Error) StackTrace

func (e *Error) StackTrace() Frames

StackTrace returns Frames that is most deeply frames in the error chain.

func (*Error) Unwrap

func (e *Error) Unwrap() error

type Frame

type Frame struct {
	Name string
	File string
	Line int
}

func (*Frame) String

func (f *Frame) String() string

type Frames

type Frames []uintptr

func StackTrace

func StackTrace(err error) Frames

func (Frames) Frame

func (f Frames) Frame(i int) *Frame

func (Frames) MarshalLogArray

func (f Frames) MarshalLogArray(e zapcore.ArrayEncoder) error

func (Frames) String

func (f Frames) String() string

Jump to

Keyboard shortcuts

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