From 157f18543f30728e3a9d82257a001e4175614a19 Mon Sep 17 00:00:00 2001 From: Younes Khoudli Date: Wed, 19 Feb 2025 16:10:18 +0100 Subject: [PATCH] fixup! editoast: stdcm_log: store requests that cause core errors --- editoast/src/models/stdcm_log.rs | 2 +- editoast/src/views/timetable/stdcm.rs | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/editoast/src/models/stdcm_log.rs b/editoast/src/models/stdcm_log.rs index 23e846d7754..b2d4016a7a8 100644 --- a/editoast/src/models/stdcm_log.rs +++ b/editoast/src/models/stdcm_log.rs @@ -24,7 +24,7 @@ editoast_common::schemas! { pub enum StdcmResponseOrError { #[schema(value_type = StdcmResponse)] Response(Response), - RequestError(InternalError), + RequestError(serde_json::Value), } #[derive(Clone, Debug, Serialize, Deserialize, Model, ToSchema)] diff --git a/editoast/src/views/timetable/stdcm.rs b/editoast/src/views/timetable/stdcm.rs index 0617185fa8e..b739b66e764 100644 --- a/editoast/src/views/timetable/stdcm.rs +++ b/editoast/src/views/timetable/stdcm.rs @@ -303,7 +303,11 @@ async fn stdcm( let stdcm_response = match stdcm_response.clone() { Ok(response) => StdcmResponseOrError::Response(response), - Err(error) => StdcmResponseOrError::RequestError(error), + Err(error) => { + StdcmResponseOrError::RequestError(serde_json::to_value(error).unwrap_or( + serde_json::Value::String("Failed to serialize the error".into()), + )) + } }; tokio::spawn(