fix: preserve archive on unlink failure

This commit is contained in:
golem
2026-08-21 16:23:01 -06:00
parent 6dee960d15
commit a701216d46
2 changed files with 26 additions and 2 deletions
+4 -2
View File
@@ -33,8 +33,10 @@ export async function archiveManifest({ root = process.cwd(), network, now = new
try {
await operations.rm(source);
} catch (error) {
await operations.rm(target, { force: true }).catch(() => {});
throw error;
throw new Error(
`archive created at ${target}, but source ${source} could not be removed; both paths were preserved: ${error.message}`,
{ cause: error },
);
}
return { source, path: target };
}