errors

package
v0.13.3-alpha.2 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func As

func As(err error, target interface{}) bool

As call errors.As.

func ErrorPath

func ErrorPath(path, message string) error

ErrorPath create PathError instance with path and error message.

func ErrorPathf

func ErrorPathf(path, msg string, args ...interface{}) error

ErrorPathf create PathError instance with path and error message.

func ErrorQueryf

func ErrorQueryf(q *query.Query, format string, args ...interface{}) error

ErrorQueryf create PathError instance by query.Query.

func Errorf

func Errorf(format string, args ...interface{}) error

Errorf call fmt.Errorf.

func Errors

func Errors(errs ...error) error

Errors create MultiPathError by error instances.

func Is

func Is(err, target error) bool

Is call errors.Is.

func New

func New(message string) error

New call errors.New.

func WithNodeAndColored

func WithNodeAndColored(err error, node ast.Node, colored bool) error

WithNodeAndColored set ast.Node and colored to error if errors instance is PathError or MultiPathError.

func WithPath

func WithPath(err error, path string) error

WithPath add path to error if errors instance is PathError or MultiPathError.

func WithQuery

func WithQuery(err error, q *query.Query) error

WithQuery add path by query.Query to error if errors instance is PathError or MultiPathError.

func Wrap

func Wrap(err error, message string) error

Wrap wrap error while paying attention to PathError and MultiPathError.

func WrapPath

func WrapPath(err error, path, message string) error

WrapPath wrap error with path while paying attention to PathError and MultiPathError.

func WrapPathf

func WrapPathf(err error, path, message string, args ...interface{}) error

WrapPathf wrap error with path while paying attention to PathError and MultiPathError.

func Wrapf

func Wrapf(err error, format string, args ...interface{}) error

Wrapf wrap error while paying attention to PathError and MultiPathError.

Types

type Error

type Error interface {
	Error() string
	// contains filtered or unexported methods
}

Error represents interface for PathError and MultiPathError.

type MultiPathError

type MultiPathError struct {
	Node ast.Node
	Errs []error
}

MultiPathError represents multiple error with path.

func (*MultiPathError) Error

func (e *MultiPathError) Error() string

type PathError

type PathError struct {
	Path         string
	Node         ast.Node
	EnabledColor bool
	Err          error
}

PathError represents error with path.

func (*PathError) Error

func (e *PathError) Error() string

Jump to

Keyboard shortcuts

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