errors

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const ErrSeperator = " -- "

ErrSeperator is used to seperate 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 equivelant

func Is

func Is(err error, target error) bool

Is checks if err is equivelant 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 equivelant

func (Error) Error

func (s Error) Error() string

func (Error) Is

func (s Error) Is(target error) bool

Is checks if targer error is equivelant 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