From d8e8d8b66ca5285fa14277e2c40e5ab8df1ecc02 Mon Sep 17 00:00:00 2001 From: Thorsten Sommer Date: Mon, 30 Jun 2025 20:32:44 +0200 Subject: [PATCH] Call file format determination synchronously & added logging --- runtime/src/file_data.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/runtime/src/file_data.rs b/runtime/src/file_data.rs index b44a9f1c..a5aa9186 100644 --- a/runtime/src/file_data.rs +++ b/runtime/src/file_data.rs @@ -123,9 +123,13 @@ async fn stream_data(file_path: &str) -> Result { } let file_path_clone = file_path.to_owned(); - let fmt = tokio::task::spawn_blocking(move || { - FileFormat::from_file(&file_path_clone) - }).await??; + let fmt = match FileFormat::from_file(&file_path_clone) { + Ok(format) => format, + Err(error) => { + error!("Failed to determine file format for '{file_path}': {error}"); + return Err(format!("Failed to determine file format for '{file_path}': {error}").into()); + }, + }; let ext = file_path.split('.').next_back().unwrap_or(""); debug!("Extracting data from file: '{file_path}', format: '{fmt:?}', extension: '{ext}'");