Function
execWithErrorHandling
(cmd: string, args?: string[], opts?: TeenProcessExecOptions)
Source from the content-addressed store, hash-verified
| 34 | * Wraps {@linkcode exec} with error handling that appends stderr to the thrown error message. |
| 35 | */ |
| 36 | export async function execWithErrorHandling(cmd: string, args?: string[], opts?: TeenProcessExecOptions) { |
| 37 | try { |
| 38 | return await exec(cmd, args, opts); |
| 39 | } catch (err) { |
| 40 | const execErr = err as ExecError; |
| 41 | execErr.message = execErr.stderr ? `${execErr.message}\nCommand error:\n${execErr.stderr}` : execErr.message; |
| 42 | throw execErr; |
| 43 | } |
| 44 | } |
Tested by
no test coverage detected