mirror of
https://github.com/tdurieux/anonymous_github.git
synced 2026-05-15 14:38:03 +02:00
Handle GitHub 409 "repository is empty" error in getCommitInfo
When a GitHub repo has no commits, the API returns 409 which was unhandled, causing raw HttpError warnings. Now throws repo_empty AnonymousError consistent with the existing convention.
This commit is contained in:
@@ -64,6 +64,13 @@ export class GitHubRepository {
|
||||
return commit.data;
|
||||
} catch (error) {
|
||||
const status = (error as { status?: number }).status;
|
||||
if (status === 409) {
|
||||
throw new AnonymousError("repo_empty", {
|
||||
httpStatus: 409,
|
||||
cause: error as Error,
|
||||
object: this,
|
||||
});
|
||||
}
|
||||
if (status === 404 || status === 422) {
|
||||
// Distinguish: does the repo itself still exist?
|
||||
let repoExists: boolean;
|
||||
|
||||
Reference in New Issue
Block a user