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
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/brave-pots-listen.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"astro": patch
---

throw original AstroUserError in mdx
liruifengv marked this conversation as resolved.
Show resolved Hide resolved
4 changes: 3 additions & 1 deletion packages/astro/src/jsx/server.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { AstroError } from '../core/errors/errors.js';
import { AstroError, AstroUserError } from '../core/errors/errors.js';
import { AstroJSX, jsx } from '../jsx-runtime/index.js';
import { renderJSX } from '../runtime/server/jsx.js';

Expand Down Expand Up @@ -52,6 +52,8 @@ function throwEnhancedErrorIfMdxComponent(error: Error, Component: any) {
// if the exception is from an mdx component
// throw an error
if (Component[Symbol.for('mdx-component')]) {
// if it's an AstroUserError, we don't need to re-throw, keep the original hint
if (AstroUserError.is(error)) return;
throw new AstroError({
message: error.message,
title: error.name,
Expand Down
Loading