errs

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Functions

func SetDefaultErrsKind

func SetDefaultErrsKind(kind Kind) cu.PartialContextFn

func SetDefaultErrsSeverity

func SetDefaultErrsSeverity(severity Severity) cu.PartialContextFn

func WithFrames

func WithFrames(b bool)

Types

type Error

type Error interface {
	error
	Severity() Severity
	TimeStamp() time.Time
	Kind() Kind
	RequestID() string
	OperationPath() cu.Operations
	StackTrace() []Frame
	Unwrap() error
}

func E

func E(args ...interface{}) Error

type Frame

type Frame struct {
	// Func contains a function name.
	Func string
	// Line contains a line number.
	Line int
	// Path contains a file path.
	Path string
}

Frame is a single step in stack trace.

func (Frame) String

func (f Frame) String() string

String formats Frame to string.

type Frames

type Frames []Frame

func Trace

func Trace(skip int) (result Frames)

... or debug.Stack()

func (Frames) String

func (fs Frames) String() string

type Kind

type Kind uint32
const (
	KindOther        Kind = iota // Unclassified error. This value is not printed in the error message.
	KindTransient                // Transient error  todo: use prev Error values
	KindInterrupted              // Interrupted ( some kind of inconsistency )
	KindInvalidValue             // Invalid value for this type of item.
	KindIO                       // External I/O error such as network failure.
	KindServer                   // Http server error
	KindRouter                   // Router error
	KindStore                    // Any kind of store failures
	KindTokenizer                // Any kind of tokenizer failures
	KindInternal                 // Internal error (for current errs pipeline impl this kind should be last in this list so that len(Kinds) = int(errs.KindInternal))
)

todo: make kind values as flags so that masks can be used to classify compound errors const KindOther Kind = 1 << (32 - 1 - iota)

func GetDefaultErrsKind

func GetDefaultErrsKind(ctx context.Context) Kind

func (Kind) String

func (k Kind) String() string

type Severity

type Severity uint32
const (
	SeverityWarning Severity = iota
	SeverityError
	SeverityCritical
)

func GetDefaultErrsSeverity

func GetDefaultErrsSeverity(ctx context.Context) Severity

func (Severity) String

func (s Severity) String() string

Jump to

Keyboard shortcuts

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