mirror of
https://github.com/SagerNet/sing.git
synced 2025-04-05 12:57:38 +03:00
Rename mutli error unwrap method
This commit is contained in:
parent
7def9588a5
commit
e839483670
2 changed files with 4 additions and 4 deletions
|
@ -17,7 +17,7 @@ type Handler interface {
|
||||||
}
|
}
|
||||||
|
|
||||||
type MultiError interface {
|
type MultiError interface {
|
||||||
UnwrapMulti() []error
|
Unwrap() []error
|
||||||
}
|
}
|
||||||
|
|
||||||
func New(message ...any) error {
|
func New(message ...any) error {
|
||||||
|
|
|
@ -16,7 +16,7 @@ func (e *multiError) Error() string {
|
||||||
return strings.Join(F.MapToString(e.errors), " | ")
|
return strings.Join(F.MapToString(e.errors), " | ")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (e *multiError) UnwrapMulti() []error {
|
func (e *multiError) Unwrap() []error {
|
||||||
return e.errors
|
return e.errors
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ func Errors(errors ...error) error {
|
||||||
|
|
||||||
func Expand(err error) []error {
|
func Expand(err error) []error {
|
||||||
if multiErr, isMultiErr := err.(MultiError); isMultiErr {
|
if multiErr, isMultiErr := err.(MultiError); isMultiErr {
|
||||||
return ExpandAll(multiErr.UnwrapMulti())
|
return ExpandAll(multiErr.Unwrap())
|
||||||
}
|
}
|
||||||
return []error{err}
|
return []error{err}
|
||||||
}
|
}
|
||||||
|
@ -64,7 +64,7 @@ func IsMulti(err error, targetList ...error) bool {
|
||||||
if !isMulti {
|
if !isMulti {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
return common.All(multiErr.UnwrapMulti(), func(it error) bool {
|
return common.All(multiErr.Unwrap(), func(it error) bool {
|
||||||
return IsMulti(it, targetList...)
|
return IsMulti(it, targetList...)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue