mirror of
https://github.com/go-sylixos/elvish.git
synced 2024-11-28 07:21:21 +08:00
pkg/eval/errs: Fix misleading message in OutOfRange.Error.
The method returns a message saying that there is no valid value if ValidHigh < ValidLow. This was useful when these fields were numbers, but since they are now strings this no longer works.
This commit is contained in:
parent
eb1770f2b9
commit
27f6ab2aa1
|
@ -18,10 +18,6 @@ type OutOfRange struct {
|
|||
|
||||
// Error implements the error interface.
|
||||
func (e OutOfRange) Error() string {
|
||||
if e.ValidHigh < e.ValidLow {
|
||||
return fmt.Sprintf(
|
||||
"out of range: %v has no valid value, but is %v", e.What, e.Actual)
|
||||
}
|
||||
return fmt.Sprintf(
|
||||
"out of range: %s must be from %s to %s, but is %s",
|
||||
e.What, e.ValidLow, e.ValidHigh, e.Actual)
|
||||
|
|
|
@ -12,10 +12,6 @@ var errorMessageTests = []struct {
|
|||
OutOfRange{What: "list index here", ValidLow: "0", ValidHigh: "2", Actual: "3"},
|
||||
"out of range: list index here must be from 0 to 2, but is 3",
|
||||
},
|
||||
{
|
||||
OutOfRange{What: "list index here", ValidLow: "1", ValidHigh: "0", Actual: "0"},
|
||||
"out of range: list index here has no valid value, but is 0",
|
||||
},
|
||||
{
|
||||
BadValue{What: "command", Valid: "callable", Actual: "number"},
|
||||
"bad value: command must be callable, but is number",
|
||||
|
|
Loading…
Reference in New Issue
Block a user