tpl/strings: Remove unnecessary error check

This commit is contained in:
Nigel van Keulen
2025-08-15 13:43:16 +02:00
committed by GitHub
parent 61482cfab6
commit 348aae91e8

View File

@@ -67,9 +67,7 @@ func (ns *Namespace) Truncate(s any, options ...any) (template.HTML, error) {
default:
return "", errors.New("too many arguments passed to truncate")
}
if err != nil {
return "", errors.New("text to truncate must be a string")
}
text, err := cast.ToStringE(textParam)
if err != nil {
return "", errors.New("text must be a string")