errors

package module
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2023 License: MIT Imports: 2 Imported by: 6

Documentation

Index

Constants

View Source
const (
	ErrNilPointerValueMsg = "nil pointer value"
	ErrZeroSizeValueMsg   = "zero size value"
)

Variables

This section is empty.

Functions

func As

func As(err error, target any) bool

As wraps function errors.As to avoid import errors package from standard library.

func ErrNilPointerValue

func ErrNilPointerValue() error

func ErrZeroSizeValue

func ErrZeroSizeValue() error

func GetDelimiter

func GetDelimiter() string

GetDelimiter returns current use delimiter chars for wrap errors.

func Is

func Is(err, target error) bool

Is wraps function errors.Is to avoid import errors package from standard library.

func New

func New(s string) error

New returns an error that formats as the given string.

func SetDelimiter

func SetDelimiter(s string)

SetDelimiter sets new delimiter chars to use for wrap errors.

func Unwrap

func Unwrap(err error) error

Unwrap wraps function errors.Unwrap to avoid import errors package from standard library.

func WrapErr

func WrapErr(s string, w error) error

WrapErr returns an error that formats the given string and wrapped the given error with Delimiter in the middle.

func WrapStr

func WrapStr(s, w string) error

WrapStr returns an error that formats the given string and wrapped the given string converted to error with Delimiter in the middle.

Types

type Wrapper

type Wrapper interface {
	// Error returns error as string.
	Error() string

	// Unwrap returns wrapped error.
	Unwrap() error
}

Wrapper describes error wrapper interface.

Jump to

Keyboard shortcuts

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