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