mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-30 22:39:58 +02:00
errors: Return error from cast.ToStringE() consistently
This commit is contained in:
committed by
Bjørn Erik Pedersen
parent
2da4ec5738
commit
6f07e5976d
@@ -58,7 +58,7 @@ func (ns *Namespace) Translate(ctx context.Context, id any, args ...any) (string
|
||||
|
||||
sid, err := cast.ToStringE(id)
|
||||
if err != nil {
|
||||
return "", nil
|
||||
return "", err
|
||||
}
|
||||
|
||||
return ns.deps.Translate(ctx, sid, templateData), nil
|
||||
@@ -165,7 +165,7 @@ func (ns *Namespace) FormatNumberCustom(precision, number any, options ...any) (
|
||||
// custom delimiter
|
||||
s, err := cast.ToStringE(options[1])
|
||||
if err != nil {
|
||||
return "", nil
|
||||
return "", err
|
||||
}
|
||||
|
||||
delim = s
|
||||
@@ -173,7 +173,7 @@ func (ns *Namespace) FormatNumberCustom(precision, number any, options ...any) (
|
||||
|
||||
s, err := cast.ToStringE(options[0])
|
||||
if err != nil {
|
||||
return "", nil
|
||||
return "", err
|
||||
}
|
||||
|
||||
rs := strings.Split(s, delim)
|
||||
|
Reference in New Issue
Block a user