fix(library): isolate per-note failures in candidate picker loop

This commit is contained in:
afiqzudinhadi 2026-08-05 15:34:50 +08:00
parent d7162d3ac2
commit 4249952f0a
2 changed files with 38 additions and 4 deletions

View file

@ -233,10 +233,16 @@ export class LibraryController {
skipped++;
continue;
}
const content = await deps.readNote(entry.path);
await deps.writeNote(entry.path, patchFrontmatter(content, candidate.patches, { defaultType: spec.itemType }));
report.resolved.push(entry.path);
picked++;
try {
const content = await deps.readNote(entry.path);
await deps.writeNote(entry.path, patchFrontmatter(content, candidate.patches, { defaultType: spec.itemType }));
report.resolved.push(entry.path);
picked++;
} catch (e) {
const msg = e instanceof Error ? e.message : String(e);
console.log(`[media-db-library] picker failed for ${entry.filename}: ${msg}`);
skipped++;
}
}
}