mirror of
https://github.com/meilisearch/MeiliSearch
synced 2024-12-01 17:15:46 +01:00
Create errors for the HTTP route issues
This commit is contained in:
parent
aace587dd1
commit
767553519d
@ -151,6 +151,7 @@ make_missing_field_convenience_builder!(MissingApiKeyExpiresAt, missing_api_key_
|
|||||||
make_missing_field_convenience_builder!(MissingApiKeyIndexes, missing_api_key_indexes);
|
make_missing_field_convenience_builder!(MissingApiKeyIndexes, missing_api_key_indexes);
|
||||||
make_missing_field_convenience_builder!(MissingSwapIndexes, missing_swap_indexes);
|
make_missing_field_convenience_builder!(MissingSwapIndexes, missing_swap_indexes);
|
||||||
make_missing_field_convenience_builder!(MissingDocumentFilter, missing_document_filter);
|
make_missing_field_convenience_builder!(MissingDocumentFilter, missing_document_filter);
|
||||||
|
make_missing_field_convenience_builder!(MissingDocumentFilter, missing_document_edition_function);
|
||||||
make_missing_field_convenience_builder!(
|
make_missing_field_convenience_builder!(
|
||||||
MissingFacetSearchFacetName,
|
MissingFacetSearchFacetName,
|
||||||
missing_facet_search_facet_name
|
missing_facet_search_facet_name
|
||||||
|
@ -337,6 +337,8 @@ UnsupportedMediaType , InvalidRequest , UNSUPPORTED_MEDIA
|
|||||||
// Experimental features
|
// Experimental features
|
||||||
VectorEmbeddingError , InvalidRequest , BAD_REQUEST ;
|
VectorEmbeddingError , InvalidRequest , BAD_REQUEST ;
|
||||||
NotFoundSimilarId , InvalidRequest , BAD_REQUEST ;
|
NotFoundSimilarId , InvalidRequest , BAD_REQUEST ;
|
||||||
|
InvalidDocumentEditionContext , InvalidRequest , BAD_REQUEST ;
|
||||||
|
InvalidDocumentEditionFunctionFilter , InvalidRequest , BAD_REQUEST ;
|
||||||
EditDocumentsByFunctionError , InvalidRequest , BAD_REQUEST
|
EditDocumentsByFunctionError , InvalidRequest , BAD_REQUEST
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -580,9 +580,9 @@ pub async fn delete_documents_by_filter(
|
|||||||
pub struct DocumentEditionByFunction {
|
pub struct DocumentEditionByFunction {
|
||||||
#[deserr(default, error = DeserrJsonError<InvalidDocumentFilter>)]
|
#[deserr(default, error = DeserrJsonError<InvalidDocumentFilter>)]
|
||||||
filter: Option<Value>,
|
filter: Option<Value>,
|
||||||
#[deserr(default, error = DeserrJsonError<InvalidDocumentFilter>)]
|
#[deserr(default, error = DeserrJsonError<InvalidDocumentEditionContext>)]
|
||||||
context: Option<Value>,
|
context: Option<Value>,
|
||||||
#[deserr(error = DeserrJsonError<InvalidDocumentFilter>, missing_field_error = DeserrJsonError::missing_document_filter)]
|
#[deserr(error = DeserrJsonError<InvalidDocumentEditionFunctionFilter>, missing_field_error = DeserrJsonError::missing_document_edition_function)]
|
||||||
function: String,
|
function: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -617,10 +617,15 @@ pub async fn edit_documents_by_function(
|
|||||||
let task = KindWithContent::DocumentEdition {
|
let task = KindWithContent::DocumentEdition {
|
||||||
index_uid,
|
index_uid,
|
||||||
filter_expr: filter,
|
filter_expr: filter,
|
||||||
context: context.map(|v| match v {
|
context: match context {
|
||||||
serde_json::Value::Object(m) => m,
|
Some(Value::Object(m)) => Some(m),
|
||||||
_ => panic!("The context must be an Object"),
|
_ => {
|
||||||
}),
|
return Err(ResponseError::from_msg(
|
||||||
|
"The context must be an object".to_string(),
|
||||||
|
Code::InvalidDocumentEditionContext,
|
||||||
|
))
|
||||||
|
}
|
||||||
|
},
|
||||||
function,
|
function,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user