diff --git a/src/lib/github.ts b/src/lib/github.ts index 86ec3b4..6dec86f 100644 --- a/src/lib/github.ts +++ b/src/lib/github.ts @@ -64,16 +64,8 @@ async function graphql(query: string, token?: string, variables?: Record "Unknown error"); - throw new GitHubApiError(body, res.status); - } - const json = (await res.json()) as { data?: T; errors?: { message: string }[] }; + + const json = await handleResponse<{ data?: T; errors?: { message: string }[] }>(res); if (json.errors && json.errors.length > 0) { throw new GitHubApiError(json.errors[0].message, 422); }