From 547ac7415a13cff80dc211f3fd64303629622cd9 Mon Sep 17 00:00:00 2001 From: ConnorSkees <39542938+ConnorSkees@users.noreply.github.com> Date: Sat, 29 Feb 2020 20:14:51 -0500 Subject: [PATCH] Improve color ops error messages --- src/value/ops.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/value/ops.rs b/src/value/ops.rs index ba6bdce..8e6130b 100644 --- a/src/value/ops.rs +++ b/src/value/ops.rs @@ -109,8 +109,8 @@ impl Sub for Value { Value::Ident(format!("{}-{}{}{}", c, quotes, s, quotes), QuoteKind::None) } Self::Null => Value::Ident(format!("{}-", c), QuoteKind::None), - v @ Self::Dimension(..) => { - return Err(format!("Undefined operation \"{} - {}\".", c, v).into()) + Self::Dimension(..) | Self::Color(..) => { + return Err(format!("Undefined operation \"{} - {}\".", c, other).into()) } _ => Value::Ident(format!("{}-{}", c, other), QuoteKind::None), }, @@ -186,7 +186,7 @@ impl Mul for Value { } }, Self::BinaryOp(..) | Self::Paren(..) => self.eval()?, - _ => todo!("incompatible mul types"), + _ => return Err(format!("Undefined operation \"{} * {}\".", self, other).into()), }) } } @@ -229,7 +229,7 @@ impl Div for Value { Value::Ident(format!("{}/{}{}{}", c, quotes, s, quotes), QuoteKind::None) } Self::Null => Value::Ident(format!("{}/", c), QuoteKind::None), - Self::Dimension(..) => { + Self::Dimension(..) | Self::Color(..) => { return Err(format!("Undefined operation \"{} / {}\".", c, other).into()) } _ => Value::Ident(format!("{}/{}", c, other), QuoteKind::None),