MCPcopy Create free account
hub / github.com/MoonshotAI/kimi-code / formatStartupError

Function formatStartupError

apps/kimi-code/src/cli/startup-error.ts:15–35  ·  view source on GitHub ↗
(
  error: unknown,
  options: StartupErrorFormatOptions = {},
)

Source from the content-addressed store, hash-verified

13}
14
15export function formatStartupError(
16 error: unknown,
17 options: StartupErrorFormatOptions = {},
18): string {
19 const errorStyle = options.errorStyle ?? chalkStderr.hex(STARTUP_ERROR_COLOR);
20
21 if (!isKimiError(error)) {
22 const operation = options.operation ?? 'start shell';
23 return `${errorStyle(`error: failed to ${operation}: ${formatUnknownErrorMessage(error)}`)}\n`;
24 }
25
26 const info = KIMI_ERROR_INFO[error.code];
27 const lines = [
28 errorStyle(`error: ${info.title}`),
29 '',
30 errorStyle('message:'),
31 errorStyle(error.message),
32 ];
33
34 return `${lines.join('\n')}\n`;
35}

Callers 2

main.test.tsFile · 0.90
mainFunction · 0.90

Calls 3

isKimiErrorFunction · 0.85
errorStyleFunction · 0.50

Tested by

no test coverage detected