Expose actionable asset download and filesystem failure details
This commit is contained in:
1 parent
8a919f85b2
commit
8c1efae296
4 files changed
+121
-18
No files matched your search
@@ -731,13 +731,19 @@ export async function importSingleFurni(params: {
|
||||
|
||||
// Download icon + SWF concurrently (independent assets). Each tries its
|
||||
// candidate URLs in order until one succeeds.
|
||||
let iconFailure = "",
|
||||
swfFailure = "";
|
||||
const [iconOkResult, swfOk] = await Promise.all([
|
||||
preservingExisting && existsSync(iconPath)
|
||||
? Promise.resolve(true)
|
||||
: tryDownloadCandidates(iconUrls, iconPath, "png"),
|
||||
: tryDownloadCandidates(iconUrls, iconPath, "png", (detail) => {
|
||||
iconFailure = detail;
|
||||
}),
|
||||
preservingExisting && existsSync(swfPath)
|
||||
? Promise.resolve(true)
|
||||
: tryDownloadCandidates(swfUrls, swfPath, "swf"),
|
||||
: tryDownloadCandidates(swfUrls, swfPath, "swf", (detail) => {
|
||||
swfFailure = detail;
|
||||
}),
|
||||
]);
|
||||
let iconOk = iconOkResult;
|
||||
|
||||
@@ -772,10 +778,13 @@ export async function importSingleFurni(params: {
|
||||
warnings.push("Icon download failed and SWF icon extraction also failed");
|
||||
}
|
||||
} else if (!iconOk) {
|
||||
warnings.push("Icon image download failed");
|
||||
warnings.push(
|
||||
`Icon image download failed: ${iconFailure || "unknown cause"}`,
|
||||
);
|
||||
}
|
||||
|
||||
if (!swfOk && !nitroDownloadOk) warnings.push("SWF download failed");
|
||||
if (!swfOk && !nitroDownloadOk)
|
||||
warnings.push(`SWF download failed: ${swfFailure || "unknown cause"}`);
|
||||
|
||||
// ── Convert SWF to Nitro ──────────────────────────────────────────
|
||||
onProgress?.("converting");
|
||||
@@ -841,12 +850,10 @@ export async function importSingleFurni(params: {
|
||||
return {
|
||||
ok: false,
|
||||
warnings,
|
||||
error: isUpdate
|
||||
? "No .nitro file could be created; existing furniture was preserved"
|
||||
: `Import rolled back: no .nitro file could be created. ${warnings
|
||||
.filter((warning) => /conversion|download|SWF/.test(warning))
|
||||
.slice(-3)
|
||||
.join(". ")}`,
|
||||
error: `${isUpdate ? "No .nitro file could be created; existing furniture was preserved" : "Import rolled back: no .nitro file could be created"} (${classname}, revision ${rev}). ${warnings
|
||||
.filter((warning) => /conversion|download|SWF/.test(warning))
|
||||
.slice(-3)
|
||||
.join(". ")}`,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user