(error: Error)
| 22 | } |
| 23 | |
| 24 | export function getErrorParts(error: Error): string[] { |
| 25 | if (error instanceof ShellError) { |
| 26 | return [ |
| 27 | `Exit code ${error.code}`, |
| 28 | error.interrupted ? INTERRUPT_MESSAGE_FOR_TOOL_USE : '', |
| 29 | error.stderr, |
| 30 | error.stdout, |
| 31 | ] |
| 32 | } |
| 33 | const parts = [error.message] |
| 34 | if ('stderr' in error && typeof error.stderr === 'string') { |
| 35 | parts.push(error.stderr) |
| 36 | } |
| 37 | if ('stdout' in error && typeof error.stdout === 'string') { |
| 38 | parts.push(error.stdout) |
| 39 | } |
| 40 | return parts |
| 41 | } |
| 42 | |
| 43 | /** |
| 44 | * Formats a Zod validation path into a readable string |
no test coverage detected