From ebe63008ec8d8d4637d71d6ce529388cd2c5143f Mon Sep 17 00:00:00 2001 From: Wes Johnson Date: Sat, 20 Jan 2024 20:50:56 -0500 Subject: [PATCH] chore(ci): add debug info for sheet fetch not clear in the workflow log whether fetch was successful or not since our error may return valid json --- scripts/utils/gsheets.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/scripts/utils/gsheets.ts b/scripts/utils/gsheets.ts index 5d10ebcd..dc5c8e1e 100644 --- a/scripts/utils/gsheets.ts +++ b/scripts/utils/gsheets.ts @@ -19,5 +19,12 @@ export const fetchGoogleSheet = async (sheetTab: SheetTab) => { const response = await fetch(sheetUrl, { headers: { "x-token": token }, }); + + if (!response.ok || response.status !== 200) { + throw new Error( + `Failed to fetch worksheet "${sheetTab}", received ${response.status}` + ); + } + return response.json() as Promise; };