Home / Function/ throwEnhancedErrorIfMdxComponent() — astro Function Reference

throwEnhancedErrorIfMdxComponent() — astro Function Reference

Architecture documentation for the throwEnhancedErrorIfMdxComponent() function in server.ts from the astro codebase.

Entity Profile

Dependency Diagram

graph TD
  9acfa750_02ca_2497_63b9_04250ba1be73["throwEnhancedErrorIfMdxComponent()"]
  90e6a33a_3784_88f7_7685_7a18e74859af["server.ts"]
  9acfa750_02ca_2497_63b9_04250ba1be73 -->|defined in| 90e6a33a_3784_88f7_7685_7a18e74859af
  6ff5edc4_5d05_1226_e52f_11caa2bf1b99["check()"]
  6ff5edc4_5d05_1226_e52f_11caa2bf1b99 -->|calls| 9acfa750_02ca_2497_63b9_04250ba1be73
  53783165_899a_054f_8624_2edd5bde81e3["renderToStaticMarkup()"]
  53783165_899a_054f_8624_2edd5bde81e3 -->|calls| 9acfa750_02ca_2497_63b9_04250ba1be73
  style 9acfa750_02ca_2497_63b9_04250ba1be73 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/integrations/mdx/src/server.ts lines 52–65

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 existing AstroError, we don't need to re-throw, keep the original hint
		if (AstroError.is(error)) return;
		// Mimic the fields of the internal `AstroError` class (not from `astro/errors`) to
		// provide better title and hint for the error overlay
		(error as any).title = error.name;
		(error as any).hint =
			`This issue often occurs when your MDX component encounters runtime errors.`;
		throw error;
	}
}

Domain

Subdomains

Frequently Asked Questions

What does throwEnhancedErrorIfMdxComponent() do?
throwEnhancedErrorIfMdxComponent() is a function in the astro codebase, defined in packages/integrations/mdx/src/server.ts.
Where is throwEnhancedErrorIfMdxComponent() defined?
throwEnhancedErrorIfMdxComponent() is defined in packages/integrations/mdx/src/server.ts at line 52.
What calls throwEnhancedErrorIfMdxComponent()?
throwEnhancedErrorIfMdxComponent() is called by 2 function(s): check, renderToStaticMarkup.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free