Rename mutli error unwrap method

This commit is contained in:
世界 2023-02-26 21:33:38 +08:00
parent 7def9588a5
commit e839483670
No known key found for this signature in database
GPG key ID: CD109927C34A63C4
2 changed files with 4 additions and 4 deletions

View file

@ -17,7 +17,7 @@ type Handler interface {
}
type MultiError interface {
UnwrapMulti() []error
Unwrap() []error
}
func New(message ...any) error {

View file

@ -16,7 +16,7 @@ func (e *multiError) Error() string {
return strings.Join(F.MapToString(e.errors), " | ")
}
func (e *multiError) UnwrapMulti() []error {
func (e *multiError) Unwrap() []error {
return e.errors
}
@ -37,7 +37,7 @@ func Errors(errors ...error) error {
func Expand(err error) []error {
if multiErr, isMultiErr := err.(MultiError); isMultiErr {
return ExpandAll(multiErr.UnwrapMulti())
return ExpandAll(multiErr.Unwrap())
}
return []error{err}
}
@ -64,7 +64,7 @@ func IsMulti(err error, targetList ...error) bool {
if !isMulti {
return false
}
return common.All(multiErr.UnwrapMulti(), func(it error) bool {
return common.All(multiErr.Unwrap(), func(it error) bool {
return IsMulti(it, targetList...)
})
}