Skip to content

Commit

Permalink
Fix: handle 404 errors on fetching github issue comments page (#2508)
Browse files Browse the repository at this point in the history
* Fix: handle 404 errors on fetching github issue comments page

Related [error thread](https://dust4ai.slack.com/archives/C05F84CFP0E/p1699882670861289)

* cleaning
  • Loading branch information
philipperolet authored Nov 13, 2023
1 parent ab717d9 commit 6feb62b
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions connectors/src/connectors/github/temporal/activities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,13 +106,23 @@ export async function githubUpsertIssueActivity(
page: resultPage,
});
resultPageLogger.info("Fetching GitHub issue comments result page.");
const comments = await getIssueCommentsPage(
installationId,
repoName,
login,
issueNumber,
resultPage
);
let comments = undefined;
try {
comments = await getIssueCommentsPage(
installationId,
repoName,
login,
issueNumber,
resultPage
);
} catch (e) {
if (e instanceof Error && "status" in e && e.status === 404) {
// Github may return a 404 on the first page if the issue has no comments
break;
} else {
throw e;
}
}
if (!comments.length) {
break;
}
Expand Down

0 comments on commit 6feb62b

Please sign in to comment.