From dc4c00ac4a4d49131c50ca55f4d63f25d4c0908e Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Tue, 21 Apr 2026 23:34:29 +0300 Subject: [PATCH] export: make project file download failures non-fatal Signed-off-by: NotAShelf Change-Id: I33ac734179c7346151e6089d4fc715916a6a6964 --- src/export/rules.rs | 46 ++++++++++++++++++++++++++------------------- 1 file changed, 27 insertions(+), 19 deletions(-) diff --git a/src/export/rules.rs b/src/export/rules.rs index c82ab96..b5373ab 100644 --- a/src/export/rules.rs +++ b/src/export/rules.rs @@ -87,7 +87,7 @@ impl Effect for CopyProjectFilesEffect { } log::info!("fetched {} (local)", file.file_name); } else if !file.url.is_empty() { - download_file( + match download_file( &context.base_path, &type_dir, &file.file_name, @@ -95,28 +95,36 @@ impl Effect for CopyProjectFilesEffect { curseforge_key.as_deref(), modrinth_token.as_deref(), ) - .await?; - - // Copy into export dir after ensuring it is present in base dir - let downloaded = - context.base_path.join(&type_dir).join(&file.file_name); - if downloaded.exists() { - fs::copy(&downloaded, &dest)?; - if let Some(ui) = &context.ui { - ui.println(format!("fetched {} (download)", file.file_name)); - } - log::info!("fetched {} (download)", file.file_name); - } else { - return Err(crate::error::PakkerError::InternalError(format!( - "download reported success but file is missing: {}", - file.file_name - ))); + .await + { + Ok(()) => { + let downloaded = + context.base_path.join(&type_dir).join(&file.file_name); + if downloaded.exists() { + fs::copy(&downloaded, &dest)?; + if let Some(ui) = &context.ui { + ui.println(format!("fetched {} (download)", file.file_name)); + } + log::info!("fetched {} (download)", file.file_name); + } else { + log::warn!( + "download reported success but file is missing: {}", + file.file_name + ); + } + }, + Err(e) => { + log::warn!( + "failed to download {} (continuing): {e}", + file.file_name + ); + }, } } else { - return Err(crate::error::PakkerError::InternalError(format!( + log::warn!( "missing project file and no download url: {}", file.file_name - ))); + ); } } }