-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
refactor(astro): put them to follow a pattern for errors #13761
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just some quick initial comments here before editing for docs!
Co-authored-by: Sarah Rainsberger <[email protected]>
…replace-astro-error-2
8703693 to
684c028
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 <[email protected]>
Co-authored-by: Sarah Rainsberger <[email protected]>
Co-authored-by: Sarah Rainsberger <[email protected]>
Co-authored-by: Sarah Rainsberger <[email protected]>
Co-authored-by: Sarah Rainsberger <[email protected]>
Co-authored-by: Sarah Rainsberger <[email protected]>
Co-authored-by: Sarah Rainsberger <[email protected]>
Co-authored-by: Sarah Rainsberger <[email protected]>
…while working with Content Collections
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 <[email protected]> * 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 <[email protected]> * Update packages/astro/src/core/errors/errors-data.ts Co-authored-by: Sarah Rainsberger <[email protected]> * Update packages/astro/src/core/errors/errors-data.ts Co-authored-by: Sarah Rainsberger <[email protected]> * Update packages/astro/src/core/errors/errors-data.ts Co-authored-by: Sarah Rainsberger <[email protected]> * Update packages/astro/src/core/errors/errors-data.ts Co-authored-by: Sarah Rainsberger <[email protected]> * Update packages/astro/src/core/errors/errors-data.ts Co-authored-by: Sarah Rainsberger <[email protected]> * Update packages/astro/src/core/errors/errors-data.ts Co-authored-by: Sarah Rainsberger <[email protected]> * Update packages/astro/src/core/errors/errors-data.ts Co-authored-by: Sarah Rainsberger <[email protected]> * 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 <[email protected]> Co-authored-by: Sarah Rainsberger <[email protected]>


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.