mirror of
https://github.com/meilisearch/MeiliSearch
synced 2025-07-04 12:27:13 +02:00
Move index swap error handling from meilisearch-http to index-scheduler
And make index_not_found error asynchronous, since we can't know whether the index will exist by the time the index swap task is processed. Improve the index-swap test to verify that future tasks are not swapped and to test the new error messages that were introduced.
This commit is contained in:
parent
b44cc62320
commit
78ffa00f98
11 changed files with 305 additions and 63 deletions
|
@ -24,20 +24,6 @@ pub enum MeilisearchHttpError {
|
|||
MissingPayload(PayloadType),
|
||||
#[error("The provided payload reached the size limit.")]
|
||||
PayloadTooLarge,
|
||||
#[error(
|
||||
"Indexes {} not found.",
|
||||
.0.iter().map(|s| format!("`{}`", s)).collect::<Vec<_>>().join(", ")
|
||||
)]
|
||||
IndexesNotFound(Vec<String>),
|
||||
#[error(
|
||||
"Indexes must be declared only once during a swap. `{0}` was specified several times."
|
||||
)]
|
||||
SwapDuplicateIndexFound(String),
|
||||
#[error(
|
||||
"Indexes must be declared only once during a swap. {} were specified several times.",
|
||||
.0.iter().map(|s| format!("`{}`", s)).collect::<Vec<_>>().join(", ")
|
||||
)]
|
||||
SwapDuplicateIndexesFound(Vec<String>),
|
||||
#[error("Two indexes must be given for each swap. The list `{:?}` contains {} indexes.",
|
||||
.0, .0.len()
|
||||
)]
|
||||
|
@ -71,9 +57,6 @@ impl ErrorCode for MeilisearchHttpError {
|
|||
MeilisearchHttpError::DocumentNotFound(_) => Code::DocumentNotFound,
|
||||
MeilisearchHttpError::InvalidExpression(_, _) => Code::Filter,
|
||||
MeilisearchHttpError::PayloadTooLarge => Code::PayloadTooLarge,
|
||||
MeilisearchHttpError::IndexesNotFound(_) => Code::IndexNotFound,
|
||||
MeilisearchHttpError::SwapDuplicateIndexFound(_) => Code::DuplicateIndexFound,
|
||||
MeilisearchHttpError::SwapDuplicateIndexesFound(_) => Code::DuplicateIndexFound,
|
||||
MeilisearchHttpError::SwapIndexPayloadWrongLength(_) => Code::BadRequest,
|
||||
MeilisearchHttpError::IndexUid(e) => e.error_code(),
|
||||
MeilisearchHttpError::SerdeJson(_) => Code::Internal,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue