Home / Function/ raiseValidationErrors() — astro Function Reference

raiseValidationErrors() — astro Function Reference

Architecture documentation for the raiseValidationErrors() function in content-entry-type.ts from the astro codebase.

Entity Profile

Dependency Diagram

graph TD
  609f9657_5b88_a72f_9d11_976071f35d46["raiseValidationErrors()"]
  b46411b3_6535_0116_92ac_cd60b744df11["content-entry-type.ts"]
  609f9657_5b88_a72f_9d11_976071f35d46 -->|defined in| b46411b3_6535_0116_92ac_cd60b744df11
  8da81c7c_4056_9a1c_b1a1_0ac3cbab6581["getContentEntryType()"]
  8da81c7c_4056_9a1c_b1a1_0ac3cbab6581 -->|calls| 609f9657_5b88_a72f_9d11_976071f35d46
  style 609f9657_5b88_a72f_9d11_976071f35d46 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/integrations/markdoc/src/content-entry-type.ts lines 232–273

function raiseValidationErrors({
	ast,
	markdocConfig,
	viteId,
	astroConfig,
	filePath,
}: {
	ast: Node;
	markdocConfig: MarkdocConfig;
	viteId: string;
	astroConfig: AstroConfig;
	filePath: string;
}) {
	const validationErrors = Markdoc.validate(ast, markdocConfig).filter((e) => {
		return (
			(e.error.level === 'error' || e.error.level === 'critical') &&
			// Ignore `variable-undefined` errors.
			// Variables can be configured at runtime,
			// so we cannot validate them at build time.
			e.error.id !== 'variable-undefined' &&
			// Ignore missing partial errors.
			// We will resolve these in `resolvePartials`.
			!(e.error.id === 'attribute-value-invalid' && /^Partial .+ not found/.test(e.error.message))
		);
	});

	if (validationErrors.length) {
		const rootRelativePath = path.relative(fileURLToPath(astroConfig.root), filePath);
		throw new MarkdocError({
			message: [
				`**${String(rootRelativePath)}** contains invalid content:`,
				...validationErrors.map((e) => `- ${e.error.message}`),
			].join('\n'),
			location: {
				// Error overlay does not support multi-line or ranges.
				// Just point to the first line.
				line: validationErrors[0].lines[0],
				file: viteId,
			},
		});
	}
}

Domain

Subdomains

Frequently Asked Questions

What does raiseValidationErrors() do?
raiseValidationErrors() is a function in the astro codebase, defined in packages/integrations/markdoc/src/content-entry-type.ts.
Where is raiseValidationErrors() defined?
raiseValidationErrors() is defined in packages/integrations/markdoc/src/content-entry-type.ts at line 232.
What calls raiseValidationErrors()?
raiseValidationErrors() is called by 1 function(s): getContentEntryType.

Analyze Your Own Codebase

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

Try Supermodel Free