MCPcopy Create free account
hub / github.com/vercel/vercel / onError

Function onError

packages/cli/src/util/events.ts:128–162  ·  view source on GitHub ↗
(err: Error)

Source from the content-addressed store, hash-verified

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);

Callers

nothing calls this directly

Calls 4

printEventsFunction · 0.85
finishFunction · 0.70
debugFunction · 0.50
destroyMethod · 0.45

Tested by

no test coverage detected