From 8f27bd481376c69986ab0cb93c9f1a450638e9c8 Mon Sep 17 00:00:00 2001 From: OlivierHecart Date: Mon, 11 Dec 2023 15:22:02 +0100 Subject: [PATCH] Filesystem backend does not reply with errors when queried key is not found --- src/lib.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index ce787a2..bc1a756 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -343,7 +343,7 @@ impl Storage for FileSystemStorage { let zfile = self.files_mgr.to_zfile(k); match self.files_mgr.read_file(&zfile).await { Ok(Some((value, timestamp))) => Ok(vec![StoredData { value, timestamp }]), - Ok(None) => Err(format!("File not found for key {:?}", key).into()), + Ok(None) => Ok(vec![]), Err(e) => { Err(format!("Get key {:?} : failed to read file {} : {}", key, zfile, e).into()) } @@ -352,7 +352,7 @@ impl Storage for FileSystemStorage { let zfile = self.files_mgr.to_zfile(NONE_KEY); match self.files_mgr.read_file(&zfile).await { Ok(Some((value, timestamp))) => Ok(vec![StoredData { value, timestamp }]), - Ok(None) => Err(format!("File not found for key {:?}", key).into()), + Ok(None) => Ok(vec![]), Err(e) => { Err(format!("Get key {:?} : failed to read file {} : {}", key, zfile, e).into()) }