term.go: Error messagge about incompatible types now truncates long values

This commit is contained in:
Celestino Amoroso 2024-05-20 05:26:33 +02:00
parent 1c4ffd7d64
commit 6bb891e09d

13
term.go
View File

@ -162,17 +162,14 @@ func (self *term) toInt(computedValue any, valueDescription string) (i int, err
func (self *term) errIncompatibleTypes(leftValue, rightValue any) error {
leftType := getTypeName(leftValue)
leftText := getFormatted(leftValue, Truncate)
rightType := getTypeName(rightValue)
rightText := getFormatted(rightValue, Truncate)
return self.tk.Errorf(
"left operand '%v' [%s] and right operand '%v' [%s] are not compatible with operator %q",
leftValue, leftType,
rightValue, rightType,
"left operand '%s' [%s] and right operand '%s' [%s] are not compatible with operator %q",
leftText, leftType,
rightText, rightType,
self.source())
// return self.tk.Errorf(
// "left operand '%v' [%T] and right operand '%v' [%T] are not compatible with operator %q",
// leftValue, leftValue,
// rightValue, rightValue,
// self.source())
}
func (self *term) errIncompatibleType(value any) error {