errors

package
v0.28.20241224232618 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2024 License: MIT Imports: 1 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrSimplifyFunc = func(e error) string {
		return e.Error() + "\n"
	}
	ErrActionSimplifyFunc = func(e error) string {
		if err, ok := e.(Error); ok {
			return err.action + ":" + e.Error() + "\n"
		} else {
			return e.Error() + "\n"
		}
	}
	ErrInLineFunc = func(e error) string {
		return "> " + e.Error() + " "
	}
	ErrActionInLineFunc = func(e error) string {
		if err, ok := e.(Error); ok {
			return "> " + err.action + ":" + e.Error() + " "
		} else {
			return "> " + e.Error() + " "
		}
	}
)

Functions

func Catch

func Catch(e error, action string) bool

func ErrorFormat added in v0.28.20240114140844

func ErrorFormat(e error, format ...ErrFormat) (s string)

func Join added in v0.28.20240114140844

func Join(e ...error) error

func Unwrap added in v0.28.20240114140844

func Unwrap(e error) []error

Types

type ErrFormat added in v0.28.20240903115607

type ErrFormat func(e error) string

type Error

type Error struct {
	Reason string
	// contains filtered or unexported fields
}

func Grow

func Grow(fe Error, e error) Error

Grow will append error action for catch

func New

func New(action string, reason ...string) (e Error)

func (Error) Error

func (t Error) Error() string

func (Error) WithReason added in v0.28.20240325172911

func (t Error) WithReason(reason string) Error

Jump to

Keyboard shortcuts

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