(apiClient: TriggerApi, endpointId: string, endpointUrl: string)
| 608 | } |
| 609 | |
| 610 | async function refreshEndpoint(apiClient: TriggerApi, endpointId: string, endpointUrl: string) { |
| 611 | try { |
| 612 | const response = await apiClient.registerEndpoint({ |
| 613 | id: endpointId, |
| 614 | url: endpointUrl, |
| 615 | }); |
| 616 | |
| 617 | if (!response.ok) { |
| 618 | return { |
| 619 | success: false as const, |
| 620 | error: response.error, |
| 621 | retryable: response.retryable, |
| 622 | }; |
| 623 | } |
| 624 | |
| 625 | return { success: true as const, data: response.data }; |
| 626 | } catch (e) { |
| 627 | if (e instanceof Error) { |
| 628 | return { success: false as const, error: e.message, retryable: true }; |
| 629 | } else { |
| 630 | return { |
| 631 | success: false as const, |
| 632 | error: "Unknown error", |
| 633 | retryable: true, |
| 634 | }; |
| 635 | } |
| 636 | } |
| 637 | } |
no test coverage detected
searching dependent graphs…