Skip to content

Commit a75feb8

Browse files
committed
impl: Fix open_kvs error propagation
It's allowed for file to be not found for other modes than `Required`. Other errors should still be propagated.
1 parent f0cd9dc commit a75feb8

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/rust/rust_kvs/src/kvs.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,9 @@ impl<J: KvsBackend> GenericKvs<J> {
135135
Ok(map)
136136
}
137137
Err(e) => {
138-
if need_file.into() == OpenKvsNeedFile::Required {
138+
// Propagate error if file was required or other error happened.
139+
if need_file.into() == OpenKvsNeedFile::Required || e != ErrorCode::KvsFileReadError
140+
{
139141
eprintln!("error: file {filename:?} could not be read: {e:?}");
140142
Err(e)
141143
} else {

0 commit comments

Comments
 (0)