Browse Source

feat: added handler to convert an error slice to string slice

pull/85/head
PacoDw 4 years ago
parent
commit
2e0cffc044
1 changed files with 5 additions and 0 deletions
  1. +5
    -0
      caste.go

+ 5
- 0
caste.go View File

@@ -1131,6 +1131,11 @@ func ToStringSliceE(i interface{}) ([]string, error) {
return v, nil
case string:
return strings.Fields(v), nil
case []error:
for _, err := range i.([]error) {
a = append(a, err.Error())
}
return a, nil
case interface{}:
str, err := ToStringE(v)
if err != nil {


Loading…
Cancel
Save