diff --git a/src/builtin/math.rs b/src/builtin/math.rs index 16fa276..d61b73a 100644 --- a/src/builtin/math.rs +++ b/src/builtin/math.rs @@ -9,7 +9,8 @@ pub(crate) fn register(f: &mut BTreeMap) { max_args!(args, 1); let num = match arg!(args, 0, "number").eval() { Value::Dimension(n, Unit::None) => n * Number::from(100), - _ => todo!("expected unitless number in builtin function `percentage()`") + v @ Value::Dimension(..) => return Err(format!("$number: Expected {} to have no units.", v).into()), + v => return Err(format!("$number: {} is not a number.", v).into()), }; Ok(Value::Dimension(num, Unit::Percent)) });