diff --git a/sync/engine/src/database_sync_operations.rs b/sync/engine/src/database_sync_operations.rs index c8235df33..00d58360a 100644 --- a/sync/engine/src/database_sync_operations.rs +++ b/sync/engine/src/database_sync_operations.rs @@ -1180,17 +1180,13 @@ async fn sql_execute_http( results.push(execute.result); } server_proto::StreamResponse::Batch(batch) => { - for error in batch.result.step_errors { - if let Some(error) = error { - return Err(Error::DatabaseSyncEngineError(format!( - "failed to execute sql: {error:?}" - ))); - } + if let Some(error) = batch.result.step_errors.into_iter().flatten().next() { + return Err(Error::DatabaseSyncEngineError(format!( + "failed to execute sql: {error:?}" + ))); } - for result in batch.result.step_results { - if let Some(result) = result { - results.push(result); - } + for result in batch.result.step_results.into_iter().flatten() { + results.push(result); } } },