docs+fix: update arch diagram/README/Insomnia, ApiError returns JSON
- architecture.mmd: CQRS trait names, ImageFetcher/RssFeedRenderer
ports, infra-wiring crate, api-types description
- README: add infra-wiring, note CQRS ports
- Insomnia: add PATCH /api/v1/reviews/:id
- ApiError returns {"error":"..."} JSON not plain text
This commit is contained in:
@@ -36,6 +36,13 @@ impl From<DomainError> for ApiError {
|
||||
|
||||
impl IntoResponse for ApiError {
|
||||
fn into_response(self) -> Response {
|
||||
domain_error_response(self.0)
|
||||
let status = domain_error_status(&self.0);
|
||||
match &self.0 {
|
||||
DomainError::InfrastructureError(_) => {
|
||||
tracing::error!("Internal error: {:?}", self.0);
|
||||
(status, axum::Json(serde_json::json!({"error": "internal server error"}))).into_response()
|
||||
}
|
||||
_ => (status, axum::Json(serde_json::json!({"error": self.0.to_string()}))).into_response(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user