Skip to content

Commit

Permalink
fixup! editoast: stdcm_log: store requests that cause core errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Khoyo committed Feb 19, 2025
1 parent 0e5a793 commit 6597aae
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
3 changes: 1 addition & 2 deletions editoast/src/models/stdcm_log.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ use utoipa::ToSchema;

use crate::core::stdcm::Request;
use crate::core::stdcm::Response;
use crate::error::InternalError;
use crate::models::prelude::*;

editoast_common::schemas! {
Expand All @@ -24,7 +23,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)]
Expand Down
6 changes: 5 additions & 1 deletion editoast/src/views/timetable/stdcm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit 6597aae

Please sign in to comment.