240: Rework error messages r=irevoire a=MarinPostma

Simplify the error messages, and make them more compliant with legacy Meilisearch.

Basically, stop composing the messages, and simply forward the message of inner errors.


Co-authored-by: marin postma <postma.marin@protonmail.com>
This commit is contained in:
bors[bot] 2021-06-24 11:36:11 +00:00 committed by GitHub
commit b6ca7929eb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 32 additions and 32 deletions

View file

@ -9,11 +9,11 @@ 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}")]
#[error("{0}")]
Facet(#[from] FacetError),
#[error("{0}")]
Milli(#[from] milli::Error),
@ -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),
}