(result: CoderCommandResult)
| 268 | | { ok: false; error: string; combined: string }; |
| 269 | |
| 270 | function interpretCoderResult(result: CoderCommandResult): InterpretedCoderCommandResult { |
| 271 | const combined = `${result.stderr}\n${result.stdout}`.trim(); |
| 272 | |
| 273 | if (result.error) { |
| 274 | return { ok: false, error: result.error, combined }; |
| 275 | } |
| 276 | |
| 277 | if (result.exitCode !== 0) { |
| 278 | return { |
| 279 | ok: false, |
| 280 | error: combined || `Exit code ${String(result.exitCode)}`, |
| 281 | combined, |
| 282 | }; |
| 283 | } |
| 284 | |
| 285 | return { ok: true, stdout: result.stdout, stderr: result.stderr }; |
| 286 | } |
| 287 | |
| 288 | function sanitizeCoderCliErrorForUi(error: unknown): string { |
| 289 | if (!(error instanceof Error)) { |
no outgoing calls
no test coverage detected