errors

package
v1.7.1 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const ErrSeparator = " -- "

ErrSeparator is used to separate the message from the cause in the error message

Variables

This section is empty.

Functions

func As

func As(err error, target any) bool

As will set target errors value to equal Error if they are equivalent

func Is

func Is(err error, target error) bool

Is checks if err is equivalent to target

func Join

func Join(errs ...error) error

Join returns an error that wraps the given errors.

func New

func New(message string) error

New returns a new error with the specified message.

func UnwrapErrors

func UnwrapErrors(err error) []error

Types

type Error

type Error string

Error provides a string based error type allowing the definition of const errors in packages

func (Error) As

func (s Error) As(target interface{}) bool

As will set target errors value to equal Error if they are equivalent

func (Error) Error

func (s Error) Error() string

func (Error) Is

func (s Error) Is(target error) bool

Is checks if target error is equivalent to Error

func (Error) Wrap

func (s Error) Wrap(err error) error

Wrap will add the provided error as a cause for this Error and return the wrapped error

type JoinedErrors

type JoinedErrors interface {
	Unwrap() []error
}

Jump to

Keyboard shortcuts

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