From c3c368836ead78ea7f65be719b0f6aabaf64c7a0 Mon Sep 17 00:00:00 2001 From: CJ Quines Date: Fri, 20 Mar 2026 10:56:53 -0400 Subject: [PATCH] fix: catch more expected getPullRequestForCommit errors --- dist/build.js | 4 ++-- dist/merge.js | 4 ++-- dist/preview.js | 4 ++-- src/compat/github/api.ts | 5 ++++- src/compat/gitlab/api.ts | 5 ++++- 5 files changed, 14 insertions(+), 8 deletions(-) diff --git a/dist/build.js b/dist/build.js index 09a4197..8c61760 100644 --- a/dist/build.js +++ b/dist/build.js @@ -22490,7 +22490,7 @@ var GitHubClient = class { const pullRequests = await this.client.repos.commits.listPullRequests(sha).then( ({ data }) => data.filter((c) => c.merged_at || c.state !== "closed") ).catch((err) => { - if (err instanceof APIError2 && err.status === 404) { + if (err instanceof APIError2 && (err.status === 401 || err.status === 403 || err.status === 404)) { return []; } throw err; @@ -25151,7 +25151,7 @@ var GitLabClient = class { ) ) ).catch((err) => { - if (err instanceof APIError3 && err.status === 404) { + if (err instanceof APIError3 && (err.status === 401 || err.status === 403 || err.status === 404)) { return []; } throw err; diff --git a/dist/merge.js b/dist/merge.js index 4a353b8..5200268 100644 --- a/dist/merge.js +++ b/dist/merge.js @@ -13309,7 +13309,7 @@ var GitHubClient = class { const pullRequests = await this.client.repos.commits.listPullRequests(sha).then( ({ data }) => data.filter((c) => c.merged_at || c.state !== "closed") ).catch((err) => { - if (err instanceof APIError && err.status === 404) { + if (err instanceof APIError && (err.status === 401 || err.status === 403 || err.status === 404)) { return []; } throw err; @@ -15970,7 +15970,7 @@ var GitLabClient = class { ) ) ).catch((err) => { - if (err instanceof APIError2 && err.status === 404) { + if (err instanceof APIError2 && (err.status === 401 || err.status === 403 || err.status === 404)) { return []; } throw err; diff --git a/dist/preview.js b/dist/preview.js index ff0b220..c91915c 100644 --- a/dist/preview.js +++ b/dist/preview.js @@ -13309,7 +13309,7 @@ var GitHubClient = class { const pullRequests = await this.client.repos.commits.listPullRequests(sha).then( ({ data }) => data.filter((c) => c.merged_at || c.state !== "closed") ).catch((err) => { - if (err instanceof APIError && err.status === 404) { + if (err instanceof APIError && (err.status === 401 || err.status === 403 || err.status === 404)) { return []; } throw err; @@ -15970,7 +15970,7 @@ var GitLabClient = class { ) ) ).catch((err) => { - if (err instanceof APIError2 && err.status === 404) { + if (err instanceof APIError2 && (err.status === 401 || err.status === 403 || err.status === 404)) { return []; } throw err; diff --git a/src/compat/github/api.ts b/src/compat/github/api.ts index aedb8a2..3f9fbf0 100644 --- a/src/compat/github/api.ts +++ b/src/compat/github/api.ts @@ -79,7 +79,10 @@ class GitHubClient implements APIClient { data.filter((c) => c.merged_at || c.state !== "closed"), ) .catch((err) => { - if (err instanceof APIError && err.status === 404) { + if ( + err instanceof APIError && + (err.status === 401 || err.status === 403 || err.status === 404) + ) { return []; } throw err; diff --git a/src/compat/gitlab/api.ts b/src/compat/gitlab/api.ts index f60cd9f..4b96f9f 100644 --- a/src/compat/gitlab/api.ts +++ b/src/compat/gitlab/api.ts @@ -134,7 +134,10 @@ class GitLabClient implements APIClient { ), ) .catch((err) => { - if (err instanceof APIError && err.status === 404) { + if ( + err instanceof APIError && + (err.status === 401 || err.status === 403 || err.status === 404) + ) { return []; } throw err;