implement to_string method, prevent memory index overwrite on validation step

This commit is contained in:
yggverse 2024-11-23 17:38:59 +02:00
parent 58ed923bc7
commit cda94cba2e
4 changed files with 42 additions and 15 deletions

View file

@ -1,5 +1,18 @@
#[derive(Debug)]
pub enum Error {
Clear,
Overwrite(i64),
Overwrite(String),
Unexpected,
}
impl Error {
pub fn to_string(&self) -> String {
match self {
Self::Clear => format!("Could not cleanup memory index"),
Self::Overwrite(key) => {
format!("Overwrite attempt for existing record `{key}`")
}
Self::Unexpected => format!("Unexpected error"),
}
}
}