export: make project file download failures non-fatal

Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: I33ac734179c7346151e6089d4fc715916a6a6964
This commit is contained in:
raf 2026-04-21 23:34:29 +03:00
commit dc4c00ac4a
Signed by: NotAShelf
GPG key ID: 29D95B64378DB4BF

View file

@ -87,7 +87,7 @@ impl Effect for CopyProjectFilesEffect {
} }
log::info!("fetched {} (local)", file.file_name); log::info!("fetched {} (local)", file.file_name);
} else if !file.url.is_empty() { } else if !file.url.is_empty() {
download_file( match download_file(
&context.base_path, &context.base_path,
&type_dir, &type_dir,
&file.file_name, &file.file_name,
@ -95,9 +95,9 @@ impl Effect for CopyProjectFilesEffect {
curseforge_key.as_deref(), curseforge_key.as_deref(),
modrinth_token.as_deref(), modrinth_token.as_deref(),
) )
.await?; .await
{
// Copy into export dir after ensuring it is present in base dir Ok(()) => {
let downloaded = let downloaded =
context.base_path.join(&type_dir).join(&file.file_name); context.base_path.join(&type_dir).join(&file.file_name);
if downloaded.exists() { if downloaded.exists() {
@ -107,16 +107,24 @@ impl Effect for CopyProjectFilesEffect {
} }
log::info!("fetched {} (download)", file.file_name); log::info!("fetched {} (download)", file.file_name);
} else { } else {
return Err(crate::error::PakkerError::InternalError(format!( log::warn!(
"download reported success but file is missing: {}", "download reported success but file is missing: {}",
file.file_name file.file_name
))); );
}
},
Err(e) => {
log::warn!(
"failed to download {} (continuing): {e}",
file.file_name
);
},
} }
} else { } else {
return Err(crate::error::PakkerError::InternalError(format!( log::warn!(
"missing project file and no download url: {}", "missing project file and no download url: {}",
file.file_name file.file_name
))); );
} }
} }
} }