diff --git a/src/parse/value/parse.rs b/src/parse/value/parse.rs index 449a1d6..48ed8f8 100644 --- a/src/parse/value/parse.rs +++ b/src/parse/value/parse.rs @@ -224,7 +224,7 @@ impl<'a> Parser<'a> { let value = self .modules .get(module) - .ok_or(("todo: module dne", module_span))? + .ok_or((format!("There is no module with the namespace \"{}\".", module), module_span))? .get_var(var)?; HigherIntermediateValue::Literal(value.clone()) } else { @@ -235,9 +235,9 @@ impl<'a> Parser<'a> { let function = self .modules .get(module) - .ok_or(("todo: module dne", module_span))? + .ok_or((format!("There is no module with the namespace \"{}\".", module), module_span))? .get_fn(fn_name.node) - .ok_or(("todo: fn dne", fn_name.span))?; + .ok_or(("Undefined function.", fn_name.span))?; if !matches!(self.toks.next(), Some(Token { kind: '(', .. })) { todo!() diff --git a/tests/use.rs b/tests/use.rs index 7a53bff..07072ba 100644 --- a/tests/use.rs +++ b/tests/use.rs @@ -25,6 +25,21 @@ error!( "@use \"sass:math\" a math;", "Error: expected \";\"." ); +error!( + unknown_module_get_variable, + "a { color: foo.$bar; }", + "Error: There is no module with the namespace \"foo\"." +); +error!( + unknown_module_get_function, + "a { color: foo.bar(); }", + "Error: There is no module with the namespace \"foo\"." +); +error!( + unknown_function, + "@use \"sass:math\";\na { color: math.bar(); }", + "Error: Undefined function." +); test!( use_as, "@use \"sass:math\" as foo;