apperr

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2022 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrCorrupted = errors.New("corrupted state")
View Source
var ErrInitialization = errors.New("wrong initialization")
View Source
var ErrInvalidPath = errors.New("invalid path")
View Source
var ErrPermissionDenied = errors.New("permission denied")
View Source
var Seperator = "\n\t"

Functions

func New

func New(context string, root error, args ...interface{}) error

func ShouldPanic

func ShouldPanic(e error) bool

func ShouldStop

func ShouldStop(e error) bool

Types

type Error

type Error struct {
	Op      Op
	Level   Level
	Kind    error
	Context string
	Root    error
}

func (*Error) Error

func (e *Error) Error() string

TODO: may be we can use errStr to cache the subErr instead of calling Error func recursively

func (*Error) Is

func (e *Error) Is(target error) bool

func (*Error) Unwrap

func (e *Error) Unwrap() error

type Kind

type Kind error

type Level

type Level uint8

Level defines severity of error. None of these levels will not abruptly halt the program, use panic() for that usecase Error levels actually start from Warn Use Fatal to gracefully stop the program Use Panic to print stack trace Trace, Debug, Info are there for future just in case we need them

const (
	Warn Level = iota
	Fatal
	Panic // prints stack
	Trace
	Debug
	Info
)

type Op

type Op string

func Ops

func Ops(e error) []Op

TODO: may be this needs to be in for loop instead of recursion

Jump to

Keyboard shortcuts

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