1#[cfg(not(target_arch = "wasm32"))]
5pub trait ResponseErrorExt {
6 fn into_response(self) -> axum::response::Response;
12}
13
14#[cfg(not(target_arch = "wasm32"))]
15impl ResponseErrorExt for objectiveai::error::ResponseError {
16 fn into_response(self) -> axum::response::Response {
17 use axum::response::IntoResponse;
18 let status = axum::http::StatusCode::from_u16(self.code)
19 .unwrap_or(axum::http::StatusCode::INTERNAL_SERVER_ERROR);
20 let body = serde_json::to_string(&self).unwrap_or_default();
21 println!("ResponseError: {}", body);
22 (status, body).into_response()
23 }
24}