malformed payload error

This commit is contained in:
mpostma 2021-09-30 10:35:24 +02:00 committed by Tamo
parent 137272b8de
commit ddd40d87a7
No known key found for this signature in database
GPG key ID: 20CD8020AFA88D69
3 changed files with 14 additions and 5 deletions

View file

@ -22,9 +22,7 @@ pub enum UpdateLoopError {
)]
FatalUpdateStoreError,
#[error("{0}")]
InvalidPayload(#[from] DocumentFormatError),
#[error("{0}")]
MalformedPayload(Box<dyn Error + Send + Sync + 'static>),
DocumentFormatError(#[from] DocumentFormatError),
// TODO: The reference to actix has to go.
#[error("{0}")]
PayloadError(#[from] actix_web::error::PayloadError),
@ -60,8 +58,7 @@ impl ErrorCode for UpdateLoopError {
Self::Internal(_) => Code::Internal,
//Self::IndexActor(e) => e.error_code(),
Self::FatalUpdateStoreError => Code::Internal,
Self::InvalidPayload(_) => Code::BadRequest,
Self::MalformedPayload(_) => Code::BadRequest,
Self::DocumentFormatError(error) => error.error_code(),
Self::PayloadError(error) => match error {
actix_web::error::PayloadError::Overflow => Code::PayloadTooLarge,
_ => Code::Internal,