Skip to content

Commit a33df1a

Browse files
committed
dry up error msg
1 parent ad5ec1b commit a33df1a

File tree

1 file changed

+8
-14
lines changed

1 file changed

+8
-14
lines changed

src/io/vss_store.rs

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -90,20 +90,14 @@ impl KVStore for VssStore {
9090

9191
let resp =
9292
tokio::task::block_in_place(|| self.runtime.block_on(self.client.get_object(&request)))
93-
.map_err(|e| match e {
94-
VssError::NoSuchKeyError(..) => {
95-
let msg = format!(
96-
"Failed to read from key {}/{}/{}: {}",
97-
primary_namespace, secondary_namespace, key, e
98-
);
99-
Error::new(ErrorKind::NotFound, msg)
100-
}
101-
_ => {
102-
let msg = format!(
103-
"Failed to read from key {}/{}/{}: {}",
104-
primary_namespace, secondary_namespace, key, e
105-
);
106-
Error::new(ErrorKind::Other, msg)
93+
.map_err(|e| {
94+
let msg = format!(
95+
"Failed to read from key {}/{}/{}: {}",
96+
primary_namespace, secondary_namespace, key, e
97+
);
98+
match e {
99+
VssError::NoSuchKeyError(..) => Error::new(ErrorKind::NotFound, msg),
100+
_ => Error::new(ErrorKind::Other, msg),
107101
}
108102
})?;
109103
Ok(resp.value.unwrap().value)

0 commit comments

Comments
 (0)