ok/jj
1
0
Fork 0
forked from mirrors/jj

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.
This commit is contained in:
Martin von Zweigbergk 2023-07-26 12:54:30 -07:00 committed by Martin von Zweigbergk
parent 84a60d15bc
commit 96e75e6ad1

View file

@ -86,7 +86,7 @@ impl OpStore for SimpleOpStore {
fn read_view(&self, id: &ViewId) -> OpStoreResult<View> { fn read_view(&self, id: &ViewId) -> OpStoreResult<View> {
let path = self.view_path(id); 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)?; let proto = crate::protos::op_store::View::decode(&*buf)?;
Ok(view_from_proto(proto)) Ok(view_from_proto(proto))