({
originalError,
timedOut,
timeout,
isMaxBuffer,
maxBuffer,
errorCode,
signal,
signalDescription,
exitCode,
isCanceled,
isGracefullyCanceled,
isForcefullyTerminated,
forceKillAfterDelay,
killSignal,
})
| 62 | }; |
| 63 | |
| 64 | const getErrorPrefix = ({ |
| 65 | originalError, |
| 66 | timedOut, |
| 67 | timeout, |
| 68 | isMaxBuffer, |
| 69 | maxBuffer, |
| 70 | errorCode, |
| 71 | signal, |
| 72 | signalDescription, |
| 73 | exitCode, |
| 74 | isCanceled, |
| 75 | isGracefullyCanceled, |
| 76 | isForcefullyTerminated, |
| 77 | forceKillAfterDelay, |
| 78 | killSignal, |
| 79 | }) => { |
| 80 | const forcefulSuffix = getForcefulSuffix(isForcefullyTerminated, forceKillAfterDelay); |
| 81 | |
| 82 | if (timedOut) { |
| 83 | return `Command timed out after ${timeout} milliseconds${forcefulSuffix}`; |
| 84 | } |
| 85 | |
| 86 | if (isGracefullyCanceled) { |
| 87 | if (signal === undefined) { |
| 88 | return `Command was gracefully canceled with exit code ${exitCode}`; |
| 89 | } |
| 90 | |
| 91 | return isForcefullyTerminated |
| 92 | ? `Command was gracefully canceled${forcefulSuffix}` |
| 93 | : `Command was gracefully canceled with ${signal} (${signalDescription})`; |
| 94 | } |
| 95 | |
| 96 | if (isCanceled) { |
| 97 | return `Command was canceled${forcefulSuffix}`; |
| 98 | } |
| 99 | |
| 100 | if (isMaxBuffer) { |
| 101 | return `${getMaxBufferMessage(originalError, maxBuffer)}${forcefulSuffix}`; |
| 102 | } |
| 103 | |
| 104 | if (errorCode !== undefined) { |
| 105 | return `Command failed with ${errorCode}${forcefulSuffix}`; |
| 106 | } |
| 107 | |
| 108 | if (isForcefullyTerminated) { |
| 109 | return `Command was killed with ${killSignal} (${getSignalDescription(killSignal)})${forcefulSuffix}`; |
| 110 | } |
| 111 | |
| 112 | if (signal !== undefined) { |
| 113 | return `Command was killed with ${signal} (${signalDescription})`; |
| 114 | } |
| 115 | |
| 116 | if (exitCode !== undefined) { |
| 117 | return `Command failed with exit code ${exitCode}`; |
| 118 | } |
| 119 | |
| 120 | return 'Command failed'; |
| 121 | }; |
no test coverage detected