errors

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func As

func As(err error, target any) bool

As just a facade for errors.As

func Is

func Is(err, target error) bool

Is just a facade for errors.Is

func IsType

func IsType(err error, t Type, otherT ...Type) bool

func Unwrap

func Unwrap(err error) error

Unwrap just a facade for errors.Unwrap

Types

type Error

type Error struct {
	Message string
	Cause   error
	Type    Type
}

func IsError

func IsError(err error) (eErr *Error, ok bool)

func Newf

func Newf(t Type, msg string, args ...any) *Error

func (*Error) Error

func (this *Error) Error() string

func (*Error) Unwrap

func (this *Error) Unwrap() error

type Type

type Type uint8
const (
	Unknown Type = iota
	System
	Config
	Network
	User
	Permission
	Expired
)

func (Type) IsEqualTo

func (t Type) IsEqualTo(other any) bool

func (Type) IsErr

func (t Type) IsErr(err error) bool

func (Type) IsZero

func (t Type) IsZero() bool

func (Type) MarshalText

func (t Type) MarshalText() ([]byte, error)

func (Type) Newf

func (t Type) Newf(msg string, args ...any) *Error

func (*Type) Set

func (t *Type) Set(plain string) error

func (Type) String

func (t Type) String() string

func (*Type) UnmarshalText

func (t *Type) UnmarshalText(text []byte) error

Jump to

Keyboard shortcuts

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