fix(thumbnail): [PKG-TOOL-THUMB-07] preserve falsy cleanup exceptions

This commit is contained in:
Harvey Zhao committed 2026-09-15 15:30:26 +08:00
1 parent 2a38067911
commit 1c522f181b
18 files changed
+5822 -20

No files matched your search

@@ -37,15 +37,19 @@ export function revoke(urls: Set<string>, url: string | undefined) {
export function cleanupAll(callbacks: Cleanup[]) {
let failure: unknown
let failed = false
for (const callback of callbacks) {
try {
callback()
}
catch (error) {
failure ||= error
if (!failed) {
failed = true
failure = error
}
}
}
if (failure)
if (failed)
throw failure
}