Rename the FieldIdMapMissingEntry from_db_name field into process

This commit is contained in:
Kerollmops 2021-06-15 11:10:50 +02:00
parent 28c004aa2c
commit f0e804afd5
No known key found for this signature in database
GPG Key ID: 92ADA4E935E71FA4
4 changed files with 9 additions and 9 deletions

View File

@ -43,8 +43,8 @@ pub enum SerializationError {
#[derive(Debug)] #[derive(Debug)]
pub enum FieldIdMapMissingEntry { pub enum FieldIdMapMissingEntry {
FieldId { field_id: FieldId, from_db_name: &'static str }, FieldId { field_id: FieldId, process: &'static str },
FieldName { field_name: String, from_db_name: &'static str }, FieldName { field_name: String, process: &'static str },
} }
#[derive(Debug)] #[derive(Debug)]
@ -224,11 +224,11 @@ impl StdError for UserError {}
impl fmt::Display for FieldIdMapMissingEntry { impl fmt::Display for FieldIdMapMissingEntry {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match self { match self {
Self::FieldId { field_id, from_db_name } => { Self::FieldId { field_id, process } => {
write!(f, "unknown field id {} coming from {} database", field_id, from_db_name) write!(f, "unknown field id {} coming from the {} process", field_id, process)
}, },
Self::FieldName { field_name, from_db_name } => { Self::FieldName { field_name, process } => {
write!(f, "unknown field name {} coming from {} database", field_name, from_db_name) write!(f, "unknown field name {} coming from the {} process", field_name, process)
}, },
} }
} }

View File

@ -62,7 +62,7 @@ pub fn obkv_to_json(
.map(|(id, value)| { .map(|(id, value)| {
let name = fields_ids_map.name(id).ok_or(error::FieldIdMapMissingEntry::FieldId { let name = fields_ids_map.name(id).ok_or(error::FieldIdMapMissingEntry::FieldId {
field_id: id, field_id: id,
from_db_name: "documents", process: "obkv_to_json",
})?; })?;
let value = serde_json::from_slice(value).map_err(error::InternalError::SerdeJson)?; let value = serde_json::from_slice(value).map_err(error::InternalError::SerdeJson)?;
Ok((name.to_owned(), value)) Ok((name.to_owned(), value))

View File

@ -61,7 +61,7 @@ impl<'t> AscDesc<'t> {
.id(&field_name) .id(&field_name)
.ok_or_else(|| FieldIdMapMissingEntry::FieldName { .ok_or_else(|| FieldIdMapMissingEntry::FieldName {
field_name: field_name.clone(), field_name: field_name.clone(),
from_db_name: "asc-desc", process: "AscDesc::new",
})?; })?;
Ok(AscDesc { Ok(AscDesc {

View File

@ -203,7 +203,7 @@ impl<'a> FacetDistribution<'a> {
for name in filterable_fields { for name in filterable_fields {
let fid = fields_ids_map.id(&name).ok_or_else(|| FieldIdMapMissingEntry::FieldName { let fid = fields_ids_map.id(&name).ok_or_else(|| FieldIdMapMissingEntry::FieldName {
field_name: name.clone(), field_name: name.clone(),
from_db_name: "filterable-fields", process: "FacetDistribution::execute",
})?; })?;
let values = self.facet_values(fid)?; let values = self.facet_values(fid)?;
distribution.insert(name, values); distribution.insert(name, values);