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

Function formatDetailValue

apps/kimi-web/src/composables/useKimiWebClient.ts:928–944  ·  view source on GitHub ↗
(value: unknown)

Source from the content-addressed store, hash-verified

926}
927
928function formatDetailValue(value: unknown): string {
929 if (value instanceof Error) {
930 // A stack already starts with "Name: message" and carries the frames the
931 // plain name/message would throw away, so prefer it when present.
932 if (typeof value.stack === 'string' && value.stack) return value.stack;
933 return value.message ? `${value.name}: ${value.message}` : value.name;
934 }
935 if (typeof value === 'string') return value;
936 if (typeof value === 'number' || typeof value === 'boolean' || typeof value === 'bigint') {
937 return String(value);
938 }
939 try {
940 return JSON.stringify(value);
941 } catch {
942 return String(value);
943 }
944}
945
946function errorName(err: unknown): string | undefined {
947 return err instanceof Error

Callers 2

warningDetailFunction · 0.85
errorDetailsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected