MCPcopy Index your code
hub / github.com/callstack/agent-device / maybeEnrichCommandFailedMessage

Function maybeEnrichCommandFailedMessage

src/kernel/errors.ts:107–118  ·  view source on GitHub ↗
(
  code: string,
  message: string,
  details: Record<string, unknown> | undefined,
)

Source from the content-addressed store, hash-verified

105}
106
107function maybeEnrichCommandFailedMessage(
108 code: string,
109 message: string,
110 details: Record<string, unknown> | undefined,
111): string {
112 if (code !== 'COMMAND_FAILED') return message;
113 if (details?.processExitError !== true) return message;
114 const stderr = typeof details?.stderr === 'string' ? details.stderr : '';
115 const excerpt = firstStderrLine(stderr);
116 if (!excerpt) return message;
117 return excerpt;
118}
119
120function firstStderrLine(stderr: string): string | null {
121 const skipPatterns = [

Callers 1

normalizeErrorFunction · 0.85

Calls 1

firstStderrLineFunction · 0.85

Tested by

no test coverage detected