refactor(astro): put them to follow a pattern for errors#13761
refactor(astro): put them to follow a pattern for errors#13761ematipico merged 19 commits intowithastro:mainfrom
Conversation
🦋 Changeset detectedLatest commit: 5325406 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 #13761 will not alter performanceComparing Summary
|
There was a problem hiding this comment.
Thank you @jp-knj. The position of the errors is important in this file. You must place these errors after this line, and before the @kind heading comment :
884ea2e to
7f48b38
Compare
|
@ematipico |
sarah11918
left a comment
There was a problem hiding this comment.
Just some quick initial comments here before editing for docs!
Co-authored-by: Sarah Rainsberger <5098874+sarah11918@users.noreply.github.com>
8703693 to
684c028
Compare
sarah11918
left a comment
There was a problem hiding this comment.
Thanks for updating based on my original comments!
Note: these errors are still not quite in the correct location! 😄 In this spot, they are showing up just BEFORE the proper heading. They should go AFTER the Content Collections heading, and typically we put newer errors at the bottom. You can check the live version of docs if it's difficult to picture here: https://docs.astro.build/en/reference/error-reference/ Figure out which message you want to follow, and place your messages after that one (for example, the last content collections error currently is "Unsupported transform in content config" so you could place it directly after that one, before the next heading.
Otherwise, I've made some suggestions below based on the structure of our error messages, and also where I think it would be helpful to send people for help. (e.g. if they passed a glob pattern, they probably don't need to go see how to construct a glob pattern, but instead, they need to see how the loaders work and which one should be used with a glob pattern)
See if what I've suggested makes sense, and please correct as necessary!
Co-authored-by: Sarah Rainsberger <5098874+sarah11918@users.noreply.github.com>
Co-authored-by: Sarah Rainsberger <5098874+sarah11918@users.noreply.github.com>
Co-authored-by: Sarah Rainsberger <5098874+sarah11918@users.noreply.github.com>
Co-authored-by: Sarah Rainsberger <5098874+sarah11918@users.noreply.github.com>
Co-authored-by: Sarah Rainsberger <5098874+sarah11918@users.noreply.github.com>
Co-authored-by: Sarah Rainsberger <5098874+sarah11918@users.noreply.github.com>
Co-authored-by: Sarah Rainsberger <5098874+sarah11918@users.noreply.github.com>
Co-authored-by: Sarah Rainsberger <5098874+sarah11918@users.noreply.github.com>
…while working with Content Collections
ematipico
left a comment
There was a problem hiding this comment.
Thank you! We can merge it once @sarah11918 approves it :)
|
Thanks too!! I learned all about:
Then, to summarize
That’s why placing them under Content Collections is the best choice. I fully got them! |
sarah11918
left a comment
There was a problem hiding this comment.
Thank you for these helpful error messages, @jp-knj ! We are happy to have your contribution! 🎉
…3761) * put them to follow a pattern for errors * feat: update changeset * chore: modify message Co-authored-by: Sarah Rainsberger <5098874+sarah11918@users.noreply.github.com> * chore: update the position of two error definitions and modify text * delete parser hint and add global pattern hint * Update packages/astro/src/core/errors/errors-data.ts Co-authored-by: Sarah Rainsberger <5098874+sarah11918@users.noreply.github.com> * Update packages/astro/src/core/errors/errors-data.ts Co-authored-by: Sarah Rainsberger <5098874+sarah11918@users.noreply.github.com> * Update packages/astro/src/core/errors/errors-data.ts Co-authored-by: Sarah Rainsberger <5098874+sarah11918@users.noreply.github.com> * Update packages/astro/src/core/errors/errors-data.ts Co-authored-by: Sarah Rainsberger <5098874+sarah11918@users.noreply.github.com> * Update packages/astro/src/core/errors/errors-data.ts Co-authored-by: Sarah Rainsberger <5098874+sarah11918@users.noreply.github.com> * Update packages/astro/src/core/errors/errors-data.ts Co-authored-by: Sarah Rainsberger <5098874+sarah11918@users.noreply.github.com> * Update packages/astro/src/core/errors/errors-data.ts Co-authored-by: Sarah Rainsberger <5098874+sarah11918@users.noreply.github.com> * Update packages/astro/src/core/errors/errors-data.ts Co-authored-by: Sarah Rainsberger <5098874+sarah11918@users.noreply.github.com> * fix: modify text * fix: update the position why: this errors about them naturally occur while working with Content Collections * fix: modify text --------- Co-authored-by: jp-knj <tomita.kenji1996@gmail.com> Co-authored-by: Sarah Rainsberger <5098874+sarah11918@users.noreply.github.com>


Changes
Errorthrows withAstroError#13759 (comment)packages/astro/src/core/errors/errors-data.tsFileGlobNotSupported– thrown when a glob pattern is passed tofile()loader.FileParserNotFound– thrown when no parser can be determined for the file extension.Both follow the project’s error‐data convention (name | title | message | hint | docs tags).
Errorthrows withAstroErrorinpackages/astro/src/content/loader/file.ts.throw new AstroError(FileGlobNotSupported)throw new AstroError({ …FileParserNotFound, message: FileParserNotFound.message(fileName) })pnpm exec changeset) so these improvements surface in release notes.Testing
pnpm test– no regressions.file('data/*.json')→ displays File glob pattern not supported banner.file('data/example.xml')→ displays File parser not found banner with doc link.No new automated tests — behaviour is unchanged; only error wiring differs.
Docs
No public-API changes. Docs remain valid.