mirror of
https://github.com/meilisearch/MeiliSearch
synced 2025-07-04 20:37:15 +02:00
move the error types to meilisearch-http
This commit is contained in:
parent
2808be9d45
commit
3ea489421e
2 changed files with 29 additions and 65 deletions
|
@ -24,6 +24,20 @@ 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(transparent)]
|
||||
IndexUid(#[from] IndexUidFormatError),
|
||||
#[error(transparent)]
|
||||
|
@ -53,6 +67,9 @@ 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::IndexUid(e) => e.error_code(),
|
||||
MeilisearchHttpError::SerdeJson(_) => Code::Internal,
|
||||
MeilisearchHttpError::HeedError(_) => Code::Internal,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue