Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

Update import-links.ts

Steven Tey276e68027d46
diff --git a/apps/web/lib/partnerstack/import-links.ts b/apps/web/lib/partnerstack/import-links.ts
index c22953fe80..e48ffb7289 100644
--- a/apps/web/lib/partnerstack/import-links.ts
+++ b/apps/web/lib/partnerstack/import-links.ts
@@ -65,27 +65,33 @@ export async function importLinks(payload: PartnerStackImportPayload) {
continue;
}
- const links = await partnerStackApi.listLinks({
- identifier: partner.email,
- });
-
- if (links.length === 0) {
- console.log(`No links found for partner ${partner.email}`);
- continue;
+ try {
+ const links = await partnerStackApi.listLinks({
+ identifier: partner.email,
+ });
+
+ if (links.length === 0) {
+ console.log(`No links found for partner ${partner.email}`);
+ continue;
+ }
+
+ await Promise.allSettled(
+ links.map(async (link) =>
+ createPartnerLink({
+ workspace: program.workspace as WorkspaceProps,
+ program,
+ partner,
+ link,
+ userId,
+ }),
+ ),
+ );
+ } catch (error) {
+ console.log(
+ `Partner ${partner.email} doesn't exist on PartnerStack, skipping...`,
+ );
}
- await Promise.allSettled(
- links.map(async (link) =>
- createPartnerLink({
- workspace: program.workspace as WorkspaceProps,
- program,
- partner,
- link,
- userId,
- }),
- ),
- );
-
await new Promise((resolve) => setTimeout(resolve, 100));
}