From ecef6e627e2264917c99df4f59e9c0573e6bff3a Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Mon, 21 Apr 2025 12:51:30 +0100 Subject: [PATCH] fix: handle github errors --- server/utils/github.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/server/utils/github.ts b/server/utils/github.ts index f1b1d58e..afec0240 100644 --- a/server/utils/github.ts +++ b/server/utils/github.ts @@ -6,4 +6,11 @@ export const query = (accessToken: string, query: string) => 'user-agent': 'roe (https://roe.dev, 0.1)', }, body: JSON.stringify({ query }), - }).then(r => r.json() as Promise<{ data: any }>) + }) + .then(r => r.json() as Promise<{ data: any }>) + .then(r => { + if ('errors' in r) { + throw r + } + return r.data + }) -- 2.51.2