Added more errors

pull/2/head
Mark 2023-08-04 12:22:23 -07:00
parent 7a1e4bd725
commit 0538b1e547
Signed by: Mark
GPG Key ID: AD62BB059C2AAEE4
1 changed files with 13 additions and 1 deletions

View File

@ -9,6 +9,8 @@ pub enum DaisyError {
EmptyGroup, EmptyGroup,
Syntax, Syntax,
BadNumber, BadNumber,
BadVariable,
BadFunction,
// Evaluation errors // Evaluation errors
BadMath, BadMath,
@ -46,8 +48,19 @@ impl DaisyError {
return FormattedText::new( return FormattedText::new(
"[e]Syntax Error:[n] Invalid number".to_string() "[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 => { DaisyError::BadMath => {
return FormattedText::new( return FormattedText::new(
"[e]Evaluation Error:[n] Failed to evaluate expression".to_string() "[e]Evaluation Error:[n] Failed to evaluate expression".to_string()
@ -57,7 +70,6 @@ impl DaisyError {
return FormattedText::new( return FormattedText::new(
"[e]Evaluation Error:[n] Number too big".to_string() "[e]Evaluation Error:[n] Number too big".to_string()
); );
}, },
DaisyError::ZeroDivision => { DaisyError::ZeroDivision => {
return FormattedText::new( return FormattedText::new(