Skip to content

Commit b6b1236

Browse files
committed
Improve error message
1 parent 7fdea43 commit b6b1236

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
-"s" # error: [line 1] Runtime error: Operand must be a number or implement the 'neg' method.
1+
-"s" # error: [line 1] Runtime error: Right side operand of type String must implement the 'neg' method.

src/lit/interpreter.cr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ module Lit
220220
elsif right.is_a? Instance
221221
return right.call_method(expr.operator.with_lexeme("neg"), ([] of Value), self)
222222
else
223-
return runtime_error(expr.operator, "Operand must be a number or implement the 'neg' method.")
223+
return runtime_error(expr.operator, "Right side operand of type #{type_of(right)} must implement the 'neg' method.")
224224
end
225225
when .bang?
226226
return falsey?(right)

0 commit comments

Comments
 (0)