Fix error messages

This commit is contained in:
Louis Dureuil 2024-12-10 11:06:58 +01:00
parent e610af36aa
commit 866ac91be3
No known key found for this signature in database
3 changed files with 5 additions and 4 deletions

View File

@ -1,12 +1,13 @@
use std::fmt::Display; use std::fmt::Display;
use crate::TaskId;
use meilisearch_types::batches::BatchId; use meilisearch_types::batches::BatchId;
use meilisearch_types::error::{Code, ErrorCode}; use meilisearch_types::error::{Code, ErrorCode};
use meilisearch_types::tasks::{Kind, Status}; use meilisearch_types::tasks::{Kind, Status};
use meilisearch_types::{heed, milli}; use meilisearch_types::{heed, milli};
use thiserror::Error; use thiserror::Error;
use crate::TaskId;
#[derive(Copy, Clone, Debug, PartialEq, Eq)] #[derive(Copy, Clone, Debug, PartialEq, Eq)]
pub enum DateField { pub enum DateField {
BeforeEnqueuedAt, BeforeEnqueuedAt,
@ -103,7 +104,7 @@ pub enum Error {
)] )]
InvalidTaskCanceledBy { canceled_by: String }, InvalidTaskCanceledBy { canceled_by: String },
#[error( #[error(
"{index_uid} is not a valid index uid. Index uid can be an integer or a string containing only alphanumeric characters, hyphens (-) and underscores (_), and can not be more than 512 bytes." "{index_uid} is not a valid index uid. Index uid can be an integer or a string containing only alphanumeric characters, hyphens (-) and underscores (_), and can not be more than 400 bytes."
)] )]
InvalidIndexUid { index_uid: String }, InvalidIndexUid { index_uid: String },
#[error("Task `{0}` not found.")] #[error("Task `{0}` not found.")]

View File

@ -550,7 +550,7 @@ impl fmt::Display for deserr_codes::InvalidSimilarId {
"the value of `id` is invalid. \ "the value of `id` is invalid. \
A document identifier can be of type integer or string, \ A document identifier can be of type integer or string, \
only composed of alphanumeric characters (a-z A-Z 0-9), hyphens (-) and underscores (_), \ only composed of alphanumeric characters (a-z A-Z 0-9), hyphens (-) and underscores (_), \
and can not be more than 512 bytes." and can not be more than 511 bytes."
) )
} }
} }

View File

@ -114,7 +114,7 @@ pub enum UserError {
"Document identifier `{}` is invalid. \ "Document identifier `{}` is invalid. \
A document identifier can be of type integer or string, \ A document identifier can be of type integer or string, \
only composed of alphanumeric characters (a-z A-Z 0-9), hyphens (-) and underscores (_), \ only composed of alphanumeric characters (a-z A-Z 0-9), hyphens (-) and underscores (_), \
and can not be more than 512 bytes.", .document_id.to_string() and can not be more than 511 bytes.", .document_id.to_string()
)] )]
InvalidDocumentId { document_id: Value }, InvalidDocumentId { document_id: Value },
#[error("Invalid facet distribution, {}", format_invalid_filter_distribution(.invalid_facets_name, .valid_facets_name))] #[error("Invalid facet distribution, {}", format_invalid_filter_distribution(.invalid_facets_name, .valid_facets_name))]