* Extracts a human-readable error message from an execa result. * * Priority order: * 1. shortMessage - execa's human-readable error (e.g., "Command failed with exit code 1: ...") * This is preferred because it already includes signal info when a process is killed, * making it more inform
( result: ExecaResultWithError, errorCode: number, )
| 73 | * 3. errorCode - fallback to just the numeric exit code |
| 74 | */ |
| 75 | function getErrorMessage( |
| 76 | result: ExecaResultWithError, |
| 77 | errorCode: number, |
| 78 | ): string { |
| 79 | if (result.shortMessage) { |
| 80 | return result.shortMessage |
| 81 | } |
| 82 | if (typeof result.signal === 'string') { |
| 83 | return result.signal |
| 84 | } |
| 85 | return String(errorCode) |
| 86 | } |
| 87 | |
| 88 | /** |
| 89 | * execFile, but always resolves (never throws) |
no outgoing calls
no test coverage detected