getViteErrorPayload() — astro Function Reference
Architecture documentation for the getViteErrorPayload() function in vite.ts from the astro codebase.
Entity Profile
Dependency Diagram
graph TD db037a41_d949_746a_d19f_f8bf66222071["getViteErrorPayload()"] 35a0af3d_ab30_11cd_b3ee_bae2c089e53b["vite.ts"] db037a41_d949_746a_d19f_f8bf66222071 -->|defined in| 35a0af3d_ab30_11cd_b3ee_bae2c089e53b 7726dc2a_99a4_8972_e1e1_f2d2472848b2["cssVariablesTheme()"] db037a41_d949_746a_d19f_f8bf66222071 -->|calls| 7726dc2a_99a4_8972_e1e1_f2d2472848b2 93f9e8cd_3823_f761_ee74_bc2fb3f0999f["transformerCompactLineOptions()"] db037a41_d949_746a_d19f_f8bf66222071 -->|calls| 93f9e8cd_3823_f761_ee74_bc2fb3f0999f style db037a41_d949_746a_d19f_f8bf66222071 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/astro/src/core/errors/dev/vite.ts lines 115–166
export async function getViteErrorPayload(err: ErrorWithMetadata): Promise<AstroErrorPayload> {
let plugin = err.plugin;
if (!plugin && err.hint) {
plugin = 'astro';
}
const message = renderErrorMarkdown(err.message.trim(), 'html');
const hint = err.hint ? renderErrorMarkdown(err.hint.trim(), 'html') : undefined;
const docslink = getDocsForError(err);
let highlighterLang = err.loc?.file?.split('.').pop();
if (ALTERNATIVE_JS_EXTS.includes(highlighterLang ?? '')) {
highlighterLang = 'js';
} else if (ALTERNATIVE_MD_EXTS.includes(highlighterLang ?? '')) {
highlighterLang = 'md';
}
const highlightedCode = err.fullCode
? await codeToHtml(err.fullCode, {
lang: highlighterLang ?? 'text',
theme: cssVariablesTheme(),
transformers: [
transformerCompactLineOptions(
err.loc?.line ? [{ line: err.loc.line, classes: ['error-line'] }] : undefined,
),
],
})
: undefined;
return {
__isEnhancedAstroErrorPayload: true,
type: 'error',
err: {
...err,
name: err.name,
type: err.type,
message,
hint,
frame: err.frame,
highlightedCode,
docslink,
loc: {
file: err.loc?.file,
line: err.loc?.line,
column: err.loc?.column,
},
plugin,
stack: err.stack,
cause: err.cause,
},
};
}
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does getViteErrorPayload() do?
getViteErrorPayload() is a function in the astro codebase, defined in packages/astro/src/core/errors/dev/vite.ts.
Where is getViteErrorPayload() defined?
getViteErrorPayload() is defined in packages/astro/src/core/errors/dev/vite.ts at line 115.
What does getViteErrorPayload() call?
getViteErrorPayload() calls 2 function(s): cssVariablesTheme, transformerCompactLineOptions.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free