From 940c7553dce388a165a3bb2c33b30f89f5c3cbba Mon Sep 17 00:00:00 2001 From: musiliandrew Date: Fri, 3 Jul 2026 11:22:55 +0300 Subject: [PATCH] fix: propagate GraphQL API errors properly instead of defaulting to notfound --- lib/github/client.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/github/client.ts b/lib/github/client.ts index 7af29c5..7979b44 100644 --- a/lib/github/client.ts +++ b/lib/github/client.ts @@ -136,6 +136,14 @@ async function gql(query: string, login: string, token: string, retries = 1): if (body.errors?.some((e) => e.type === "RATE_LIMITED")) { return fail("ratelimit", "GitHub rate limit hit. Try again shortly."); } + + if (body.errors && body.errors.length > 0) { + console.error("[github] GraphQL errors:", body.errors); + if (!body.errors.some(e => e.type === "NOT_FOUND")) { + return fail("network", body.errors[0].message || "GitHub API returned an error."); + } + } + return { user: body.data?.user ?? null }; } return fail("network", "GitHub request failed."); // unreachable; satisfies the type checker