mirror of
https://github.com/rm-dr/daisy
synced 2025-07-05 10:09:33 -07:00
Cleaned up eval error messages
This commit is contained in:
@ -11,4 +11,27 @@ pub enum EvalError {
|
||||
ZeroDivision,
|
||||
IncompatibleUnit,
|
||||
BadDefineName
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
impl ToString for EvalError {
|
||||
fn to_string(&self) -> String {
|
||||
match self {
|
||||
EvalError::BadMath => {
|
||||
String::from("Failed to evaluate expression")
|
||||
},
|
||||
EvalError::TooBig => {
|
||||
String::from("Number too big")
|
||||
},
|
||||
EvalError::ZeroDivision => {
|
||||
String::from("Division by zero")
|
||||
},
|
||||
EvalError::IncompatibleUnit => {
|
||||
String::from("Incompatible units")
|
||||
},
|
||||
EvalError::BadDefineName => {
|
||||
String::from("Invalid variable name")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user