( code: string, message: string, details: Record<string, unknown> | undefined, )
| 105 | } |
| 106 | |
| 107 | function 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 | |
| 120 | function firstStderrLine(stderr: string): string | null { |
| 121 | const skipPatterns = [ |
no test coverage detected