Skip to content

Commit

Permalink
fix errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Mr-Leshiy committed Jan 16, 2025
1 parent b3fd211 commit f9b69cf
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
8 changes: 4 additions & 4 deletions catalyst-gateway/bin/src/service/api/documents/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,10 @@ impl DocumentApi {
match document.0.into_bytes_limit(MAXIMUM_DOCUMENT_SIZE).await {
Ok(doc_bytes) => put_document::endpoint(doc_bytes.to_vec()).await,
Err(ReadBodyError::PayloadTooLarge) => put_document::Responses::PayloadTooLarge.into(),
Err(e) => {
put_document::Responses::BadRequest(Json(PutDocumentBadRequest::new(&format!(
"Failed to read document from the request, err: {e}"
))))
Err(_) => {
put_document::Responses::BadRequest(Json(PutDocumentBadRequest::new(
"Failed to read document from the request",
)))
.into()
},
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,11 @@ pub(crate) async fn endpoint(doc_bytes: Vec<u8>) -> AllResponses {
Err(err) => AllResponses::handle_error(&err),
}
},
Err(e) => Responses::BadRequest(Json(PutDocumentBadRequest::new(&e))).into(),
Err(_) => {
Responses::BadRequest(Json(PutDocumentBadRequest::new(
"Invalid CBOR encoded document",
)))
.into()
},
}
}

0 comments on commit f9b69cf

Please sign in to comment.