fix: log errors for invalid content config#14350
Conversation
🦋 Changeset detectedLatest commit: 8d5de1d The changes in this PR will be included in the next version bump. Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
CodSpeed Performance ReportMerging #14350 will not alter performanceComparing Summary
Footnotes |
sarah11918
left a comment
There was a problem hiding this comment.
Just a quick changeset thought for your consideration!
(In general, I'll usually suggest starting these with the verb that describes the kind of change to the codebase (adds, improves, refactors), vs what the code in the PR actually does (logs). So just popping in with thoughts if you go in that direction!)
| 'astro': patch | ||
| --- | ||
|
|
||
| Improves error reporting for content collections by adding logging for configuration errors that had previously been silently ignored. Also adds a new error that is thrown if a live collection is used in `content.config.ts` rather than `live.config.ts`. |
There was a problem hiding this comment.
Maybe "if a live collection is defined in ..." but yes! Love it!
ematipico
left a comment
There was a problem hiding this comment.
Since we can't test it, could you share a screenshot of the end result?
|
@ematipico good idea. Added |
Changes
When looking at ways to catch misuse of live collections I realised that currently we're silently ignoring errors when parsing content config. This PR changes it to log errors in these cases. Because these aren't currently fatal errors, throwing would be a breaking change, so I'm just logging for now.
Additionally, if live collections are enabled then it checks if it failed because
createLiveCollectionhas been used incontent.config.tsand if so it does throw an error (which was I was originally trying to do).Testing
Docs