diff --git a/scraper/src/github-scraper/parseEvents.ts b/scraper/src/github-scraper/parseEvents.ts index f3a1650c..03edf57b 100644 --- a/scraper/src/github-scraper/parseEvents.ts +++ b/scraper/src/github-scraper/parseEvents.ts @@ -191,7 +191,16 @@ export const parseEvents = async (events: IGitHubEvent[]) => { event.payload.action === "closed" && event.payload.pull_request?.merged ) { - const turnaroundTime = await calculateTurnaroundTime(event); + let turnaroundTime: number | undefined = undefined; + try { + turnaroundTime = await calculateTurnaroundTime(event); + } catch (e) { + console.error( + `Error calculating turnaround time for event ${event.id}: ${e}`, + `Likely due to PR author ${event.payload.pull_request.user.login} being deleted`, + event, + ); + } appendEvent(event.payload.pull_request.user.login, { type: "pr_merged", title: `${event.repo.name}#${event.payload.pull_request.number}`, @@ -200,7 +209,14 @@ export const parseEvents = async (events: IGitHubEvent[]) => { text: event.payload.pull_request.title, turnaround_time: turnaroundTime, }); - await addCollaborations(event, eventTime); + try { + await addCollaborations(event, eventTime); + } catch (e) { + console.error( + `Error adding collaborations for event ${event.id}: ${e}`, + event, + ); + } } break; case "PullRequestReviewEvent":