mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-04-01 09:05:27 +00:00
handle memory clear errors
This commit is contained in:
parent
efa3bc48c3
commit
8a4e979d48
8 changed files with 33 additions and 11 deletions
|
|
@ -1,4 +1,4 @@
|
|||
mod error;
|
||||
pub mod error;
|
||||
pub use error::Error;
|
||||
|
||||
use std::{cell::RefCell, collections::HashMap};
|
||||
|
|
@ -34,8 +34,14 @@ impl Memory {
|
|||
}
|
||||
|
||||
/// Cleanup index
|
||||
pub fn clear(&self) {
|
||||
self.index.borrow_mut().clear()
|
||||
pub fn clear(&self) -> Result<(), Error> {
|
||||
let mut index = self.index.borrow_mut();
|
||||
index.clear();
|
||||
if index.is_empty() {
|
||||
Ok(())
|
||||
} else {
|
||||
Err(Error::Clear)
|
||||
}
|
||||
}
|
||||
|
||||
/// Get `profile_identity_gemini_id` vector match given `request`
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue