mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-21 20:46:30 -05:00
tpl: Modify error messages of after, first, and last
Modified the messages functions after, first, and last threw on being passed invalid parameters (index or limit) to be more standardised and resemble what Go compiler would throw. Fixes #6415
This commit is contained in:
parent
0e75af74db
commit
65b7d4221b
1 changed files with 3 additions and 3 deletions
|
@ -61,7 +61,7 @@ func (ns *Namespace) After(index interface{}, seq interface{}) (interface{}, err
|
|||
}
|
||||
|
||||
if indexv < 0 {
|
||||
return nil, errors.New("can't return negative/empty count of items from sequence")
|
||||
return nil, errors.New("sequence bounds out of range [" + cast.ToString(indexv) + ":]")
|
||||
}
|
||||
|
||||
seqv := reflect.ValueOf(seq)
|
||||
|
@ -219,7 +219,7 @@ func (ns *Namespace) First(limit interface{}, seq interface{}) (interface{}, err
|
|||
}
|
||||
|
||||
if limitv < 0 {
|
||||
return nil, errors.New("can't return negative count of items from sequence")
|
||||
return nil, errors.New("sequence length must be non-negative")
|
||||
}
|
||||
|
||||
seqv := reflect.ValueOf(seq)
|
||||
|
@ -379,7 +379,7 @@ func (ns *Namespace) Last(limit interface{}, seq interface{}) (interface{}, erro
|
|||
}
|
||||
|
||||
if limitv < 0 {
|
||||
return nil, errors.New("can't return negative/empty count of items from sequence")
|
||||
return nil, errors.New("sequence length must be non-negative")
|
||||
}
|
||||
|
||||
seqv := reflect.ValueOf(seq)
|
||||
|
|
Loading…
Reference in a new issue