summaryrefslogtreecommitdiff
path: root/packages/integrations/mdx
diff options
context:
space:
mode:
authorGravatar Erika <3019731+Princesseuh@users.noreply.github.com> 2023-09-06 20:36:50 +0200
committerGravatar GitHub <noreply@github.com> 2023-09-06 20:36:50 +0200
commit6df4f3bd9d74de47dc8732e7f3b42bef42d2facf (patch)
tree883c609d5c46954fb684dc5e82141d8e05828af2 /packages/integrations/mdx
parenteb7615f25a88c25dc6db50b199877a8f79597a74 (diff)
downloadastro-6df4f3bd9d74de47dc8732e7f3b42bef42d2facf.tar.gz
astro-6df4f3bd9d74de47dc8732e7f3b42bef42d2facf.tar.zst
astro-6df4f3bd9d74de47dc8732e7f3b42bef42d2facf.zip
fix: MDX errors not having stack trace and a confusing name (#8438)
* fix(mdx): Fix errors having weird names and no stack trace * chore: changeset
Diffstat (limited to 'packages/integrations/mdx')
-rw-r--r--packages/integrations/mdx/src/index.ts7
1 files changed, 7 insertions, 0 deletions
diff --git a/packages/integrations/mdx/src/index.ts b/packages/integrations/mdx/src/index.ts
index 9053e824c..c27abb4d1 100644
--- a/packages/integrations/mdx/src/index.ts
+++ b/packages/integrations/mdx/src/index.ts
@@ -153,7 +153,14 @@ export default function mdx(partialMdxOptions: Partial<MdxOptions> = {}): AstroI
};
} catch (e: any) {
const err: SSRError = e;
+
+ // For some reason MDX puts the error location in the error's name, not very useful for us.
+ err.name = 'MDXError';
err.loc = { file: fileId, line: e.line, column: e.column };
+
+ // For another some reason, MDX doesn't include a stack trace. Weird
+ Error.captureStackTrace(err);
+
throw err;
}
},