diff options
Diffstat (limited to 'libimagentrycategory/src/category.rs')
-rw-r--r-- | libimagentrycategory/src/category.rs | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/libimagentrycategory/src/category.rs b/libimagentrycategory/src/category.rs index 89763913..1e77495e 100644 --- a/libimagentrycategory/src/category.rs +++ b/libimagentrycategory/src/category.rs @@ -88,23 +88,16 @@ impl EntryCategory for Entry { } .map_err_into(CEK::HeaderReadError), - Ok(&Value::String(ref s)) => Ok(Some(s.clone().into())), + Ok(Some(&Value::String(ref s))) => Ok(Some(s.clone().into())), + Ok(None) => Err(CEK::StoreReadError.into_error()).map_err_into(CEK::HeaderReadError), Ok(_) => Err(CEK::TypeError.into_error()).map_err_into(CEK::HeaderReadError), } } fn has_category(&self) -> Result<bool> { - let res = self.get_header().read(&String::from("category.value")); - if res.is_err() { - let res = res.unwrap_err(); - match res.kind() { - &TQEK::IdentifierNotFoundInDocument(_) => Ok(false), - _ => Err(res), - } + self.get_header().read(&String::from("category.value")) .map_err_into(CEK::HeaderReadError) - } else { - Ok(true) - } + .map(|e| e.is_some()) } } |