(e: unknown, pattern: string, inline = false)
| 167 | } |
| 168 | |
| 169 | function formatBashError(e: unknown, pattern: string, inline = false): never { |
| 170 | if (e instanceof ShellError) { |
| 171 | if (e.interrupted) { |
| 172 | throw new MalformedCommandError( |
| 173 | `Shell command interrupted for pattern "${pattern}": [Command interrupted]`, |
| 174 | ) |
| 175 | } |
| 176 | const output = formatBashOutput(e.stdout, e.stderr, inline) |
| 177 | throw new MalformedCommandError( |
| 178 | `Shell command failed for pattern "${pattern}": ${output}`, |
| 179 | ) |
| 180 | } |
| 181 | |
| 182 | const message = errorMessage(e) |
| 183 | const formatted = inline ? `[Error: ${message}]` : `[Error]\n${message}` |
| 184 | throw new MalformedCommandError(formatted) |
| 185 | } |
no test coverage detected