Skip to content
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

Fix throw AstroUserError in mdx #11192

Merged

Conversation

liruifengv
Copy link
Member

@liruifengv liruifengv commented Jun 6, 2024

Changes

  • Fix throw astroUserError in mdx
---
import { AstroError } from 'astro/errors';

throw new AstroError('Error message', 'Error hint not display');
---

<div>
Throw a custom AstroUserError in mdx.
</div>

Use this compoent in mdx, above code will throw a custom AstroUserError, but error.hint is not display, because it was catched by throwEnhancedErrorIfMdxComponent function.

Testing

Docs

Copy link

changeset-bot bot commented Jun 6, 2024

🦋 Changeset detected

Latest commit: de5e0d7

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

@github-actions github-actions bot added the pkg: astro Related to the core `astro` package (scope) label Jun 6, 2024
@liruifengv liruifengv changed the title Fix throw astrousererror in mdx Fix throw AstroUserError in mdx Jun 6, 2024
@liruifengv
Copy link
Member Author

Related Starlight PR: withastro/starlight#1542, Starlight use AstroError

Copy link
Member

@ematipico ematipico left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I proposed a suggestion for the changeset, let me know what you think

.changeset/brave-pots-listen.md Outdated Show resolved Hide resolved
Co-authored-by: Emanuele Stoppa <[email protected]>
@liruifengv
Copy link
Member Author

I proposed a suggestion for the changeset, let me know what you think

Thank you

@ematipico ematipico merged commit 58b10a0 into withastro:main Jun 6, 2024
13 checks passed
@liruifengv liruifengv deleted the fix-throw-astrousererror-in-mdx branch June 6, 2024 11:34
@astrobot-houston astrobot-houston mentioned this pull request Jun 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pkg: astro Related to the core `astro` package (scope)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants