From 0538b1e547621bfa4c1bfc5712620708e3cddbad Mon Sep 17 00:00:00 2001 From: Mark Date: Fri, 4 Aug 2023 12:22:23 -0700 Subject: [PATCH] Added more errors --- src/errors.rs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/errors.rs b/src/errors.rs index fcbcec6..1b715b1 100644 --- a/src/errors.rs +++ b/src/errors.rs @@ -9,6 +9,8 @@ pub enum DaisyError { EmptyGroup, Syntax, BadNumber, + BadVariable, + BadFunction, // Evaluation errors BadMath, @@ -46,8 +48,19 @@ impl DaisyError { return FormattedText::new( "[e]Syntax Error:[n] Invalid number".to_string() ); + }, + DaisyError::BadVariable => { + return FormattedText::new( + "[e]Syntax Error:[n] Bad variable name".to_string() + ); + }, + DaisyError::BadFunction => { + return FormattedText::new( + "[e]Syntax Error:[n] Bad function name".to_string() + ); } + DaisyError::BadMath => { return FormattedText::new( "[e]Evaluation Error:[n] Failed to evaluate expression".to_string() @@ -57,7 +70,6 @@ impl DaisyError { return FormattedText::new( "[e]Evaluation Error:[n] Number too big".to_string() ); - }, DaisyError::ZeroDivision => { return FormattedText::new(