From 96e75e6ad1fee61f2aabec6d58f99caad6c5f2d2 Mon Sep 17 00:00:00 2001 From: Martin von Zweigbergk Date: Wed, 26 Jul 2023 12:54:30 -0700 Subject: [PATCH] simple_op_store: return `NotFound` for missing views I guess we don't depend on `read_view()` ever returning `NotFound` the way `read_operation()` does, but it seems like it still should return `NotFound` when the view doesn't exist. --- lib/src/simple_op_store.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/src/simple_op_store.rs b/lib/src/simple_op_store.rs index d3e325acc..a09db7f64 100644 --- a/lib/src/simple_op_store.rs +++ b/lib/src/simple_op_store.rs @@ -86,7 +86,7 @@ impl OpStore for SimpleOpStore { fn read_view(&self, id: &ViewId) -> OpStoreResult { let path = self.view_path(id); - let buf = fs::read(path)?; + let buf = fs::read(path).map_err(not_found_to_store_error)?; let proto = crate::protos::op_store::View::decode(&*buf)?; Ok(view_from_proto(proto))