Improve error handling

This commit is contained in:
awsr
2025-11-28 14:26:03 -08:00
parent 1b5295dd5e
commit eb4f4c683c
2 changed files with 60 additions and 45 deletions
+6 -2
View File
@@ -643,8 +643,12 @@ async function thumbCacheCleanup(folder, imgCount) {
const t1 = performance.now();
log(`Thumbnail DB cleanup: folder=${folder} kept=${staticGalleryHashes.size} deleted=${delcount} time=${Math.floor(t1 - t0)}ms`);
})
.catch((err) => {
error('Thumbnail DB cleanup: Cleanup failed.', err.message);
.catch((reason) => {
if (reason instanceof Error) {
error('Thumbnail DB cleanup: Cleanup failed.', reason.message);
} else {
log('Thumbnail DB cleanup:', reason);
}
})
.finally(() => {
cb_clearMsg();