batch_mode_process_response/
process_output_data.rs1crate::ix!();
3
4pub async fn process_output_data(
5 output_data: &BatchOutputData,
6 workspace: &dyn BatchWorkspaceInterface,
7 expected_content_type: &ExpectedContentType,
8
9) -> Result<(), BatchOutputProcessingError> {
10
11 let mut failed_entries = Vec::new();
12
13 for response_record in output_data.responses() {
14
15 info!("-------[processing output data record]");
16
17 if let Some(success_body) = response_record.response().body().as_success() {
18
19 if let Err(e) = handle_successful_response(success_body,workspace,expected_content_type).await {
20
21 eprintln!(
22 "Failed to process response for request ID '{}', error: {:?}, response: {:?}",
23 response_record.custom_id(),
24 e,
25 success_body
26 );
27
28 failed_entries.push(response_record);
29 }
30 }
31 }
32
33 if !failed_entries.is_empty() {
34 save_failed_entries(workspace,&failed_entries).await?;
35 }
36
37 Ok(())
38}