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