The sync report containing errors to export.
Promise that resolves when export is complete.
export async function exportSyncErrorLog(report: SyncReport): Promise<void> {
if (!report?.errors?.length) {
console.warn("[Export] ⚠️ No errors to export");
return;
}
console.info(
`[Export] 📤 Exporting error log: ${report.errors.length} errors`,
);
try {
const errorLog = {
timestamp: report.timestamp,
totalEntries: report.totalEntries,
successfulUpdates: report.successfulUpdates,
failedUpdates: report.failedUpdates,
errors: report.errors,
};
await exportToJson(
errorLog as unknown as Record<string, unknown>,
"anilist-sync-errors",
);
console.info("[Export] ✅ Successfully exported error log");
} catch (error) {
console.error("[Export] ❌ Failed to export error log:", error);
}
}
Exports sync error logs to JSON file; extracts errors from sync report if present.