integrationos_domain/domain/error/
axum_error.rs

1use crate::IntegrationOSError;
2use axum::{
3    response::{IntoResponse, Response},
4    Json,
5};
6use http::StatusCode;
7
8impl IntoResponse for IntegrationOSError {
9    fn into_response(self) -> Response {
10        (&self).into_response()
11    }
12}
13
14impl<'a> IntoResponse for &'a IntegrationOSError {
15    fn into_response(self) -> Response {
16        let body = self.to_owned().as_application().as_json();
17
18        let status: StatusCode = self.into();
19
20        (status, Json(body)).into_response()
21    }
22}