Skip to content

Commit

Permalink
editoast: train-simulation: return SimulationFailed on 500 from core
Browse files Browse the repository at this point in the history
  • Loading branch information
Castavo committed Jul 7, 2024
1 parent b05d26f commit 1848027
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion editoast/src/views/v2/train_schedule.rs
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,15 @@ pub async fn train_simulation(
}

// Compute simulation from core
let result = simulation_request.fetch(core.as_ref()).await?;
let result = simulation_request.fetch(core.as_ref()).await;

let result = match result {
Ok(result) => result,
Err(core_error) if core_error.status.is_server_error() => {
SimulationResponse::SimulationFailed { core_error }
}
err => return err,
};

// Cache the simulation response
redis_conn
Expand Down

0 comments on commit 1848027

Please sign in to comment.