errors

package module
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2024 License: GPL-3.0 Imports: 8 Imported by: 284

README

errors (internal)

Golang SpiralScout errors package, fully compatible with the standard errors. Include stacktrace and operations.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Separator = ":\n\t"

separator -> new line plus tabulator to intend error if previous not nil

Functions

func E

func E(args ...any) error

E builds an error value from its arguments.

func Errorf

func Errorf(format string, args ...any) error

func Is

func Is(kind Kind, err error) bool

Is reports whether err is an *Error of the given Kind

func MarshalError

func MarshalError(err error) []byte

func MarshalErrorAppend

func MarshalErrorAppend(err error, b []byte) []byte

func Match

func Match(err1, err2 error) bool

func SafelyDo

func SafelyDo(work func())

Do smt with no care about result (and panics)

func Str

func Str(text string) error

errors.New

func UnmarshalError

func UnmarshalError(b []byte) error

Types

type Error

type Error struct {
	Op     Op
	Kind   Kind
	Err    error
	Raised string
	// contains filtered or unexported fields
}

func (*Error) Error

func (e *Error) Error() string

func (*Error) MarshalAppend

func (e *Error) MarshalAppend(b []byte) []byte

func (*Error) MarshalBinary

func (e *Error) MarshalBinary() ([]byte, error)

func (*Error) UnmarshalBinary

func (e *Error) UnmarshalBinary(b []byte) error

type Kind

type Kind uint16
const (
	Undefined Kind = iota
	TimeOut
	Network
	FileNotFound
	Retry
	Stop
	MaxJobs
	QueueSize
)

General 0 - 99

const (
	Register Kind = iota + 100
	Providers
	Logger
	ArgType
	Init
	Serve
	Unsupported
	Disabled
	Traverse
	FunctionCall
)

Endure Kinds of errors. 100 - 199

const (
	WatcherStopped Kind = iota + 200
	SoftJob
	WorkerAllocate
	NoFreeWorkers
	Encode
	Decode
	ExecTTL
	IdleTTL
	TTL
)

RR core kinds 200 - 299

const (
	// kv plugin
	EmptyKey Kind = iota + 300
	EmptyItem
	NoKeys
	NoSuchBucket
	BucketShouldBeSet
	NoConfig

	// Reload plugin
	SkipFile
	NoWalkerConfig
)

RR plugins kinds 300 - 399

func (Kind) String

func (k Kind) String() string

type Op

type Op string

Op describes an operation

Jump to

Keyboard shortcuts

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