From 1dfe77bcfff7c907116a113e777740fce000b08f Mon Sep 17 00:00:00 2001 From: ConnorSkees <39542938+ConnorSkees@users.noreply.github.com> Date: Fri, 28 Feb 2020 01:06:51 -0500 Subject: [PATCH] Better mixin error messages --- src/mixin.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/mixin.rs b/src/mixin.rs index d217e7b..d61d663 100644 --- a/src/mixin.rs +++ b/src/mixin.rs @@ -98,7 +98,9 @@ impl Mixin { Expr::Style(s) => stmts.push(Stmt::Style(*s)), Expr::Styles(s) => stmts.extend(s.into_iter().map(Stmt::Style)), Expr::Include(s) => stmts.extend(s), - Expr::MixinDecl(..) | Expr::FunctionDecl(..) | Expr::Debug(..) | Expr::Warn(..) => { + Expr::FunctionDecl(..) => return Err("Mixins may not contain function declarations.".into()), + Expr::MixinDecl(..) => return Err("Mixins may not contain mixin declarations.".into()), + Expr::Debug(..) | Expr::Warn(..) => { todo!() } Expr::Selector(selector) => { @@ -131,7 +133,7 @@ pub(crate) fn eat_include>( .expect("this must exist because we have already peeked"); let name = match kind { TokenKind::Ident(s) => s, - _ => return Err(SassError::new("Expected identifier.", pos)), + _ => return Err("Expected identifier.".into()), }; devour_whitespace(toks);