mirror of
https://github.com/meilisearch/meilisearch.git
synced 2025-01-31 15:31:53 +08:00
change error message for payload size limit
This commit is contained in:
parent
4b292c6e9b
commit
f62779671b
@ -21,6 +21,8 @@ pub enum UpdateActorError {
|
|||||||
FatalUpdateStoreError,
|
FatalUpdateStoreError,
|
||||||
#[error("invalid payload: {0}")]
|
#[error("invalid payload: {0}")]
|
||||||
InvalidPayload(Box<dyn Error + Send + Sync + 'static>),
|
InvalidPayload(Box<dyn Error + Send + Sync + 'static>),
|
||||||
|
#[error("payload error: {0}")]
|
||||||
|
PayloadError(#[from] actix_web::error::PayloadError),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T> From<tokio::sync::mpsc::error::SendError<T>> for UpdateActorError {
|
impl<T> From<tokio::sync::mpsc::error::SendError<T>> for UpdateActorError {
|
||||||
@ -39,7 +41,6 @@ internal_error!(
|
|||||||
UpdateActorError: heed::Error,
|
UpdateActorError: heed::Error,
|
||||||
std::io::Error,
|
std::io::Error,
|
||||||
serde_json::Error,
|
serde_json::Error,
|
||||||
actix_http::error::PayloadError,
|
|
||||||
tokio::task::JoinError
|
tokio::task::JoinError
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -51,6 +52,12 @@ impl ErrorCode for UpdateActorError {
|
|||||||
UpdateActorError::IndexActor(e) => e.error_code(),
|
UpdateActorError::IndexActor(e) => e.error_code(),
|
||||||
UpdateActorError::FatalUpdateStoreError => Code::Internal,
|
UpdateActorError::FatalUpdateStoreError => Code::Internal,
|
||||||
UpdateActorError::InvalidPayload(_) => Code::BadRequest,
|
UpdateActorError::InvalidPayload(_) => Code::BadRequest,
|
||||||
|
UpdateActorError::PayloadError(error) => {
|
||||||
|
match error {
|
||||||
|
actix_http::error::PayloadError::Overflow => Code::PayloadTooLarge,
|
||||||
|
_ => Code::Internal,
|
||||||
|
}
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user