review changes

This commit is contained in:
marin postma 2021-06-21 13:57:32 +02:00
parent 763ee521be
commit 56686dee40
No known key found for this signature in database
GPG key ID: 6088B7721C3E39F9
10 changed files with 24 additions and 23 deletions

View file

@ -3,7 +3,7 @@ use std::io::{BufRead, BufReader, Write};
use std::path::Path;
use std::sync::Arc;
use anyhow::Context;
use anyhow::{Context, bail};
use heed::RoTxn;
use indexmap::IndexMap;
use milli::update::{IndexDocumentsMethod, UpdateFormat::JsonStream};
@ -126,7 +126,7 @@ impl Index {
match Arc::try_unwrap(index.0) {
Ok(inner) => inner.prepare_for_closing().wait(),
Err(_) => todo!("Could not close index properly."),
Err(_) => bail!("Could not close index properly."),
}
Ok(())

View file

@ -9,9 +9,9 @@ pub type Result<T> = std::result::Result<T, IndexError>;
#[derive(Debug, thiserror::Error)]
pub enum IndexError {
#[error("Internal error: {0}")]
#[error("internal error: {0}")]
Internal(Box<dyn Error + Send + Sync + 'static>),
#[error("Document with id {0} not found.")]
#[error("document with id {0} not found.")]
DocumentNotFound(String),
#[error("error with facet: {0}")]
Facet(#[from] FacetError),
@ -39,7 +39,7 @@ impl ErrorCode for IndexError {
#[derive(Debug, thiserror::Error)]
pub enum FacetError {
#[error("Invalid facet expression, expected {}, found: {1}", .0.join(", "))]
#[error("invalid facet expression, expected {}, found: {1}", .0.join(", "))]
InvalidExpression(&'static [&'static str], Value),
}