handle memory clear errors

This commit is contained in:
yggverse 2024-11-23 11:48:02 +02:00
parent efa3bc48c3
commit 8a4e979d48
8 changed files with 33 additions and 11 deletions

View file

@ -87,8 +87,10 @@ impl Gemini {
/// Create new `Memory` index from `Database` for `Self`
pub fn index(&self) -> Result<(), Error> {
// Cleanup previous records
self.memory.clear();
// Clear previous records
if let Err(reason) = self.memory.clear() {
return Err(Error::MemoryClear(reason));
}
// Build new index
match self.database.records() {
@ -101,7 +103,8 @@ impl Gemini {
}
Err(reason) => return Err(Error::DatabaseIndex(reason)),
};
Ok(()) // @TODO
Ok(())
}
}