errorx

package
v0.0.0-...-8cfda75 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2024 License: MIT Imports: 2 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrorType = reflect.TypeOf((*error)(nil)).Elem()

Functions

func Break

func Break[T any](pre error) func(f func() (T, error)) (T, error)

Break 函数是一个高阶函数,用于处理错误并决定是否继续执行另一个函数。 如果pre参数不为nil,它会返回一个零值和pre错误,从而中断后续的执行; 如果pre为nil,则会调用并返回f()的结果。

func Concern

func Concern[T any](_ T, err error) error

func Continue

func Continue[T any](pre error) func(f func() (T, error)) (T, error)

Continue 函数允许在执行f()之前检查pre错误,如果f()返回错误,它会将这两个错误合并并返回

func Equals

func Equals(err, target error) bool

Equals 判断两个错误是否相等

func Ignore

func Ignore[T any](v T, _ error) T

func Join

func Join(err error, errs ...error) error

func Must

func Must[T any](v T, err error) T

func Quiet

func Quiet[T any](v T, err error) T

func Silence

func Silence(_ error)

func Stringfy

func Stringfy(err error) string

Types

This section is empty.

Jump to

Keyboard shortcuts

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