From 9292c193925a73be28178a884de4215d28fe95cb Mon Sep 17 00:00:00 2001 From: tdurieux Date: Thu, 7 May 2026 05:54:51 +0300 Subject: [PATCH] Handle GitHub 422 errors as commit_not_found and sanitize error responses --- src/core/source/GitHubRepository.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/source/GitHubRepository.ts b/src/core/source/GitHubRepository.ts index b2fe333..4ac689f 100644 --- a/src/core/source/GitHubRepository.ts +++ b/src/core/source/GitHubRepository.ts @@ -64,7 +64,7 @@ export class GitHubRepository { return commit.data; } catch (error) { const status = (error as { status?: number }).status; - if (status === 404) { + if (status === 404 || status === 422) { // Distinguish: does the repo itself still exist? let repoExists: boolean; try { @@ -76,7 +76,7 @@ export class GitHubRepository { throw new AnonymousError( repoExists ? "commit_not_found" : "repo_not_found", { - httpStatus: 404, + httpStatus: repoExists ? 422 : 404, cause: error as Error, object: this, }