MCPcopy
hub / github.com/vitejs/vite / buildErrorMessage

Function buildErrorMessage

packages/vite/src/node/server/middlewares/error.ts:25–36  ·  view source on GitHub ↗
(
  err: RollupError,
  args: string[] = [],
  includeStack = true,
)

Source from the content-addressed store, hash-verified

23}
24
25export function buildErrorMessage(
26 err: RollupError,
27 args: string[] = [],
28 includeStack = true,
29): string {
30 if (err.plugin) args.push(` Plugin: ${colors.magenta(err.plugin)}`)
31 const loc = err.loc ? `:${err.loc.line}:${err.loc.column}` : ''
32 if (err.id) args.push(` File: ${colors.cyan(err.id)}${loc}`)
33 if (err.frame) args.push(colors.yellow(pad(err.frame)))
34 if (includeStack && err.stack) args.push(pad(cleanStack(err.stack)))
35 return args.join('\n')
36}
37
38function cleanStack(stack: string) {
39 return stack

Callers 6

instantiateModuleFunction · 0.90
debugMethod · 0.90
infoMethod · 0.90
warnMethod · 0.90
warmupRequestMethod · 0.90
logErrorFunction · 0.85

Calls 2

padFunction · 0.90
cleanStackFunction · 0.85

Tested by

no test coverage detected