mirror of
https://github.com/meilisearch/MeiliSearch
synced 2025-07-04 20:37:15 +02:00
draft without error handling
This commit is contained in:
parent
8f6b6c9042
commit
8748df2ca4
3 changed files with 265 additions and 1 deletions
|
@ -62,6 +62,9 @@ pub enum UserError {
|
|||
InvalidFilter(pest::error::Error<ParserRule>),
|
||||
InvalidFilterAttribute(pest::error::Error<ParserRule>),
|
||||
InvalidGeoField { document_id: Value, object: Value },
|
||||
InvalidFilterAttributeNom,
|
||||
InvalidFilterValue,
|
||||
InvalidSortName { name: String },
|
||||
InvalidSortableAttribute { field: String, valid_fields: HashSet<String> },
|
||||
SortRankingRuleMissing,
|
||||
InvalidStoreFile,
|
||||
|
@ -82,6 +85,11 @@ impl From<io::Error> for Error {
|
|||
Error::IoError(error)
|
||||
}
|
||||
}
|
||||
impl From<std::num::ParseFloatError> for UserError {
|
||||
fn from(_: std::num::ParseFloatError) -> UserError {
|
||||
UserError::InvalidFilterValue
|
||||
}
|
||||
}
|
||||
|
||||
impl From<fst::Error> for Error {
|
||||
fn from(error: fst::Error) -> Error {
|
||||
|
@ -208,6 +216,9 @@ impl StdError for InternalError {}
|
|||
impl fmt::Display for UserError {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
match self {
|
||||
//TODO
|
||||
Self::InvalidFilterAttributeNom => f.write_str("parser error "),
|
||||
Self::InvalidFilterValue => f.write_str("parser error "),
|
||||
Self::AttributeLimitReached => f.write_str("maximum number of attributes reached"),
|
||||
Self::CriterionError(error) => write!(f, "{}", error),
|
||||
Self::DocumentLimitReached => f.write_str("maximum number of documents reached"),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue