start unifying error messages

This commit is contained in:
Sebastian Hugentobler 2025-05-25 10:55:50 +02:00
parent a25b6d1e92
commit 283155c38b
Signed by: shu
SSH key fingerprint: SHA256:ppcx6MlixdNZd5EUM1nkHOKoyQYoJwzuQKXM6J/t66M
2 changed files with 29 additions and 29 deletions

View file

@ -17,21 +17,21 @@ use crate::{
#[derive(Error, Debug)]
pub enum InterpreterError {
#[error("[line {0}] MINUS unary expression expects a number on the right")]
#[error("line {0}: MINUS unary expression expects a number on the right")]
UnaryExpressionNotANumber(usize),
#[error("[line {0}] unknown unary operator: {1}")]
#[error("line {0}: unknown unary operator: {1}")]
UnaryOperatorUnknown(usize, String),
#[error("[line {0}] unknown binary operator: {1}")]
#[error("line {0}: unknown binary operator: {1}")]
BinaryOperatorUnknown(usize, String),
#[error("[line {0}] left or right is not a number.")]
#[error("line {0}: left or right is not a number.")]
BinaryExpressionNeedsNumber(usize),
#[error("[line {0}] left or right is neither a number nor string.")]
#[error("line {0}: left or right is neither a number nor string.")]
BinaryExpressionNeedsNumberOrString(usize),
#[error("{0}")]
UndefinedVariable(EnvironmentError),
#[error("[line {0}] {1} is not callable.")]
#[error("line {0}: {1} is not callable.")]
NotACallable(usize, Value),
#[error("[line {0}] {1}.")]
#[error("line {0}: {1}.")]
FailedToCall(usize, CallingError),
}