Log hydration failures instead of swallowing them silently (AI)
hydrateArticleNow()'s catch-all discarded network, HTTP, and parsing errors alike with no diagnostic, using the same fallback for all of them. A real bug in parseFrontmatter()/deriveContentFields() would silently leave an article title-less forever with no way to tell it apart from a transient fetch blip. Now logged via console.error. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
2b2cdb1d3c
commit
4e2229fed9
1 file changed
+8
-1
+8
-1
@@ -294,7 +294,14 @@ async function hydrateArticleNow(stub) {
|
||||
const authoritative = { ...stub };
|
||||
Object.assign(stub, meta, authoritative, deriveContentFields(meta, content, stub.path), { hydrated: true });
|
||||
await setCacheEntry(stub.path, { mtime: stub.mtime, article: stub });
|
||||
} catch { /* leave stub unhydrated — retried next time it's rendered */ }
|
||||
} catch (error) {
|
||||
// Leave stub unhydrated — retried next time it's rendered. Logged
|
||||
// (not surfaced in the UI, which just shows the title-less card)
|
||||
// so a persistent failure — a real bug in parseFrontmatter() or
|
||||
// deriveContentFields(), not just a transient fetch blip — is still
|
||||
// visible somewhere instead of silently retrying forever.
|
||||
console.error(`Failed to hydrate article ${stub.path}:`, error);
|
||||
}
|
||||
return stub;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user