跳到主要内容

errors

Error

// Error represents a error's specification.
type Error struct {
Err error
Type ErrorType
Meta any
}

errorMsgs

type errorMsgs []*Error

IsType

// IsType judges one error.
func (msg *Error) IsType(flags ErrorType) bool {
return (msg.Type & flags) > 0
}

Unwrap

// Unwrap returns the wrapped error, to allow interoperability with errors.Is(), errors.As() and errors.Unwrap()
func (msg *Error) Unwrap() error {
return msg.Err
}