({
updateUrl,
pipe,
account
}: {
updateUrl: string;
pipe: PipeOld;
account: Account;
})
| 273 | } |
| 274 | |
| 275 | async function updateExistingPipe({ |
| 276 | updateUrl, |
| 277 | pipe, |
| 278 | account |
| 279 | }: { |
| 280 | updateUrl: string; |
| 281 | pipe: PipeOld; |
| 282 | account: Account; |
| 283 | }): Promise<PipeOld> { |
| 284 | p.log.info(`Pipe "${pipe.name}" already exists. Updating instead.`); |
| 285 | |
| 286 | const updateResponse = await fetch(updateUrl, { |
| 287 | method: 'POST', |
| 288 | headers: { |
| 289 | 'Content-Type': 'application/json', |
| 290 | Authorization: `Bearer ${account.apiKey}` |
| 291 | }, |
| 292 | body: JSON.stringify(pipe) |
| 293 | }); |
| 294 | |
| 295 | if (!updateResponse.ok) { |
| 296 | const error = await updateResponse.text(); |
| 297 | throw new Error( |
| 298 | `HTTP error! status: ${updateResponse.status}, message: ${error}` |
| 299 | ); |
| 300 | } |
| 301 | |
| 302 | return (await updateResponse.json()) as PipeOld; |
| 303 | } |
| 304 | |
| 305 | export function handleError({ |
| 306 | spinner, |
nothing calls this directly
no outgoing calls
no test coverage detected