chore(web): FieldError -> MalformedError

since now it is also thrown for mismatching nodes
This commit is contained in:
əlemi 2024-11-20 18:05:28 +01:00
parent 298f0a3774
commit e2535e32ab
Signed by: alemi
GPG key ID: A4895B84D311642C
2 changed files with 7 additions and 3 deletions

View file

@ -14,7 +14,11 @@ pub async fn upload(
} }
let mut uploaded_something = false; let mut uploaded_something = false;
while let Some(field) = multipart.next_field().await.unwrap() { while let Some(field) = multipart
.next_field()
.await
.unwrap() // TODO OOOPS THIS SLIPPED GET RID OF IT
{
let _ = if let Some(filename) = field.file_name() { let _ = if let Some(filename) = field.file_name() {
filename.to_string() filename.to_string()
} else { } else {

View file

@ -6,7 +6,7 @@ pub enum ApiError {
Database(#[from] sea_orm::DbErr), Database(#[from] sea_orm::DbErr),
#[error("encountered malformed object: {0}")] #[error("encountered malformed object: {0}")]
Field(#[from] apb::FieldErr), Malformed(#[from] apb::FieldErr),
#[error("http signature error: {0:?}")] #[error("http signature error: {0:?}")]
HttpSignature(#[from] httpsign::HttpSignatureError), HttpSignature(#[from] httpsign::HttpSignatureError),
@ -104,7 +104,7 @@ impl axum::response::IntoResponse for ApiError {
"inner": format!("{pull:#?}"), "inner": format!("{pull:#?}"),
})) }))
).into_response(), ).into_response(),
ApiError::Field(x) => ( ApiError::Malformed(x) => (
axum::http::StatusCode::BAD_REQUEST, axum::http::StatusCode::BAD_REQUEST,
axum::Json(serde_json::json!({ axum::Json(serde_json::json!({
"error": "field", "error": "field",