tpl/strings: Remove unnecessary error check · gohugoio/hugo@348aae9 (original) (raw)
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -67,9 +67,7 @@ func (ns *Namespace) Truncate(s any, options ...any) (template.HTML, error) { | ||
| 67 | 67 | default: |
| 68 | 68 | return "", errors.New("too many arguments passed to truncate") |
| 69 | 69 | } |
| 70 | -if err != nil { | |
| 71 | -return "", errors.New("text to truncate must be a string") | |
| 72 | - } | |
| 70 | + | |
| 73 | 71 | text, err := cast.ToStringE(textParam) |
| 74 | 72 | if err != nil { |
| 75 | 73 | return "", errors.New("text must be a string") |