mirror of
https://github.com/meilisearch/MeiliSearch
synced 2024-11-23 05:14:27 +01:00
fix a wrong error message
This commit is contained in:
parent
82bdb54537
commit
00f6af6475
@ -24,8 +24,8 @@ pub enum MeilisearchHttpError {
|
|||||||
MissingPayload(PayloadType),
|
MissingPayload(PayloadType),
|
||||||
#[error("The provided payload reached the size limit.")]
|
#[error("The provided payload reached the size limit.")]
|
||||||
PayloadTooLarge,
|
PayloadTooLarge,
|
||||||
#[error("Two indexes must be given for each swap. The list `{:?}` contains {} indexes.",
|
#[error("Two indexes must be given for each swap. The list `[{}]` contains {} indexes.",
|
||||||
.0, .0.len()
|
.0.iter().map(|uid| format!("\"{uid}\"")).collect::<Vec<_>>().join(", "), .0.len()
|
||||||
)]
|
)]
|
||||||
SwapIndexPayloadWrongLength(Vec<IndexUid>),
|
SwapIndexPayloadWrongLength(Vec<IndexUid>),
|
||||||
#[error(transparent)]
|
#[error(transparent)]
|
||||||
|
@ -17,6 +17,7 @@ async fn swap_indexes_bad_format() {
|
|||||||
"link": "https://docs.meilisearch.com/errors#bad-request"
|
"link": "https://docs.meilisearch.com/errors#bad-request"
|
||||||
}
|
}
|
||||||
"###);
|
"###);
|
||||||
|
|
||||||
let (response, code) = server.index_swap(json!(["doggo"])).await;
|
let (response, code) = server.index_swap(json!(["doggo"])).await;
|
||||||
snapshot!(code, @"400 Bad Request");
|
snapshot!(code, @"400 Bad Request");
|
||||||
snapshot!(json_string!(response), @r###"
|
snapshot!(json_string!(response), @r###"
|
||||||
@ -43,16 +44,30 @@ async fn swap_indexes_bad_indexes() {
|
|||||||
"link": "https://docs.meilisearch.com/errors#invalid-swap-indexes"
|
"link": "https://docs.meilisearch.com/errors#invalid-swap-indexes"
|
||||||
}
|
}
|
||||||
"###);
|
"###);
|
||||||
|
|
||||||
let (response, code) = server.index_swap(json!([{ "indexes": ["doggo"]}])).await;
|
let (response, code) = server.index_swap(json!([{ "indexes": ["doggo"]}])).await;
|
||||||
snapshot!(code, @"400 Bad Request");
|
snapshot!(code, @"400 Bad Request");
|
||||||
snapshot!(json_string!(response), @r###"
|
snapshot!(json_string!(response), @r###"
|
||||||
{
|
{
|
||||||
"message": "Two indexes must be given for each swap. The list `[IndexUid(\"doggo\")]` contains 1 indexes.",
|
"message": "Two indexes must be given for each swap. The list `[\"doggo\"]` contains 1 indexes.",
|
||||||
"code": "invalid_swap_indexes",
|
"code": "invalid_swap_indexes",
|
||||||
"type": "invalid_request",
|
"type": "invalid_request",
|
||||||
"link": "https://docs.meilisearch.com/errors#invalid-swap-indexes"
|
"link": "https://docs.meilisearch.com/errors#invalid-swap-indexes"
|
||||||
}
|
}
|
||||||
"###);
|
"###);
|
||||||
|
|
||||||
|
let (response, code) =
|
||||||
|
server.index_swap(json!([{ "indexes": ["doggo", "crabo", "croco"]}])).await;
|
||||||
|
snapshot!(code, @"400 Bad Request");
|
||||||
|
snapshot!(json_string!(response), @r###"
|
||||||
|
{
|
||||||
|
"message": "Two indexes must be given for each swap. The list `[\"doggo\", \"crabo\", \"croco\"]` contains 3 indexes.",
|
||||||
|
"code": "invalid_swap_indexes",
|
||||||
|
"type": "invalid_request",
|
||||||
|
"link": "https://docs.meilisearch.com/errors#invalid-swap-indexes"
|
||||||
|
}
|
||||||
|
"###);
|
||||||
|
|
||||||
let (response, code) = server.index_swap(json!([{ "indexes": ["doggo", "doggo"]}])).await;
|
let (response, code) = server.index_swap(json!([{ "indexes": ["doggo", "doggo"]}])).await;
|
||||||
snapshot!(code, @"400 Bad Request");
|
snapshot!(code, @"400 Bad Request");
|
||||||
snapshot!(json_string!(response), @r###"
|
snapshot!(json_string!(response), @r###"
|
||||||
@ -63,6 +78,7 @@ async fn swap_indexes_bad_indexes() {
|
|||||||
"link": "https://docs.meilisearch.com/errors#invalid-swap-duplicate-index-found"
|
"link": "https://docs.meilisearch.com/errors#invalid-swap-duplicate-index-found"
|
||||||
}
|
}
|
||||||
"###);
|
"###);
|
||||||
|
|
||||||
let (response, code) = server
|
let (response, code) = server
|
||||||
.index_swap(json!([{ "indexes": ["doggo", "catto"]}, { "indexes": ["girafo", "doggo"]}]))
|
.index_swap(json!([{ "indexes": ["doggo", "catto"]}, { "indexes": ["girafo", "doggo"]}]))
|
||||||
.await;
|
.await;
|
||||||
|
Loading…
Reference in New Issue
Block a user