mirror of https://github.com/rm-dr/daisy
Added more errors
parent
7a1e4bd725
commit
0538b1e547
|
@ -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(
|
||||||
|
|
Loading…
Reference in New Issue