(err: Error)
| 126 | |
| 127 | let onErrorCalled = false; |
| 128 | const onError = (err: Error) => { |
| 129 | if (finishCalled || onErrorCalled) return; |
| 130 | if (err.name === 'AbortError') { |
| 131 | finish(); |
| 132 | return; |
| 133 | } |
| 134 | onErrorCalled = true; |
| 135 | o++; |
| 136 | |
| 137 | const errorMessage = `Deployment event stream error: ${err.message}`; |
| 138 | if (!findOpts.follow) { |
| 139 | log(errorMessage); |
| 140 | return; |
| 141 | } |
| 142 | |
| 143 | debug(errorMessage); |
| 144 | clearTimeout(poller); |
| 145 | stream.destroy(err); |
| 146 | |
| 147 | const retryFindOpts = { |
| 148 | ...findOpts, |
| 149 | since: latestLogDate, |
| 150 | }; |
| 151 | |
| 152 | setTimeout(() => { |
| 153 | if (abortController?.signal.aborted) return; |
| 154 | // retry without maximum amount nor clear past logs etc |
| 155 | printEvents(client, urlOrDeploymentId, { |
| 156 | mode, |
| 157 | onEvent, |
| 158 | quiet, |
| 159 | findOpts: retryFindOpts, |
| 160 | }).then(resolve, reject); |
| 161 | }, 2000); |
| 162 | }; |
| 163 | |
| 164 | stream.on('end', finish); |
| 165 | stream.on('data', onData); |
nothing calls this directly
no test coverage detected