feat: added handler to convert an error slice to string slice
This commit is contained in:
parent
e38d93ddee
commit
2e0cffc044
5
caste.go
5
caste.go
@ -1131,6 +1131,11 @@ func ToStringSliceE(i interface{}) ([]string, error) {
|
|||||||
return v, nil
|
return v, nil
|
||||||
case string:
|
case string:
|
||||||
return strings.Fields(v), nil
|
return strings.Fields(v), nil
|
||||||
|
case []error:
|
||||||
|
for _, err := range i.([]error) {
|
||||||
|
a = append(a, err.Error())
|
||||||
|
}
|
||||||
|
return a, nil
|
||||||
case interface{}:
|
case interface{}:
|
||||||
str, err := ToStringE(v)
|
str, err := ToStringE(v)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user