errors

package
v0.0.0-...-5bb0c7b Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2021 License: MIT Imports: 6 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Cause

func Cause(err error) error

func Code

func Code(err error) string

func New

func New(message string) error

func WithCode

func WithCode(cause error, code string, message string) error

func WithStack

func WithStack(err error) error

Types

type Frame

type Frame uintptr

Frame represents a program counter inside a stack frame.

func (Frame) Format

func (f Frame) Format(s fmt.State, verb rune)

Format formats the frame according to the fmt.Formatter interface.

%s    source file
%d    source line
%n    function name
%v    equivalent to %s:%d

Format accepts flags that alter the printing of some verbs, as follows:

%+s   path of source file relative to the compile time GOPATH
%+v   equivalent to %+s:%d

type StackTrace

type StackTrace []Frame

StackTrace is stack of Frames from innermost (newest) to outermost (oldest).

func (StackTrace) Format

func (st StackTrace) Format(s fmt.State, verb rune)

Format formats the stack of Frames according to the fmt.Formatter interface.

%s	lists source files for each Frame in the stack
%v	lists the source file and line number for each Frame in the stack

Format accepts flags that alter the printing of some verbs, as follows:

%+v   Prints filename, function, and line number for each Frame in the stack.

type WithCodeError

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

func AsWithCode

func AsWithCode(err error) *WithCodeError

func (*WithCodeError) Cause

func (w *WithCodeError) Cause() error

func (*WithCodeError) Code

func (w *WithCodeError) Code() string

func (*WithCodeError) Error

func (w *WithCodeError) Error() string

func (*WithCodeError) Format

func (w *WithCodeError) Format(s fmt.State, verb rune)

func (*WithCodeError) Message

func (w *WithCodeError) Message() string

Jump to

Keyboard shortcuts

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