kverror

package
v0.0.0-...-1fc08d0 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2023 License: MIT Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrKeyExists   = New("key exist", true)
	ErrKeyNotFound = New("key not found", false)
	ErrUnknown     = New("unknown error", true)
)

sentinel errors.

Functions

This section is empty.

Types

type Error

type Error struct {
	Err      error
	Message  string
	Data     any `json:"-"`
	Loggable bool
}

Error is a type alias, custom error.

func (*Error) AddData

func (e *Error) AddData(data any) KVError

AddData adds extra data to error.

func (*Error) DestoryData

func (e *Error) DestoryData() KVError

DestoryData removes added data from error.

func (*Error) Error

func (e *Error) Error() string

func (*Error) Unwrap

func (e *Error) Unwrap() error

Unwrap unwraps error.

func (*Error) Wrap

func (e *Error) Wrap(err error) KVError

Wrap wraps given error.

type KVError

type KVError interface {
	Wrap(err error) KVError
	Unwrap() error
	AddData(any) KVError
	DestoryData() KVError
	Error() string
}

KVError defines custom error behaviours.

func New

func New(m string, l bool) KVError

New instantiates new Error instance.

Jump to

Keyboard shortcuts

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