diff --git a/src/evaluate/mod.rs b/src/evaluate/mod.rs index 657d9b2..d9078b6 100644 --- a/src/evaluate/mod.rs +++ b/src/evaluate/mod.rs @@ -10,6 +10,7 @@ pub enum EvalError { TooBig, ZeroDivision, IncompatibleUnit, + IncompatibleUnits(String, String), BadDefineName, Undefined(String) } @@ -28,7 +29,10 @@ impl ToString for EvalError { String::from("Division by zero") }, EvalError::IncompatibleUnit => { - String::from("Incompatible units") + String::from("Incompatible unit") + }, + EvalError::IncompatibleUnits(a, b) => { + format!("Incompatible units ({} and {})", a, b) }, EvalError::BadDefineName => { String::from("Invalid variable name") diff --git a/src/evaluate/operator.rs b/src/evaluate/operator.rs index 2b0798c..270c3c3 100644 --- a/src/evaluate/operator.rs +++ b/src/evaluate/operator.rs @@ -157,7 +157,13 @@ pub fn eval_operator(g: &Expression, context: &mut Context) -> Result