From 38033fcb355d32d2efb4132ab5ab0c53ca9242c9 Mon Sep 17 00:00:00 2001 From: mat Date: Thu, 19 May 2022 19:27:34 +0000 Subject: add warning when github ratelimit is exceeded --- src/constants.ts | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src') diff --git a/src/constants.ts b/src/constants.ts index b8761b7..8143381 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -88,8 +88,14 @@ function fetchFile(path: string): Promise { 'Accept': 'application/vnd.github.v3+json', }, ) + const data = await r.json() as any + // this happens when the ratelimit is exceeded + if (!('path' in data)) { + console.error('Error getting GitHub file', data) + } + const file = { path: data.path, content: Buffer.from(data.content, data.encoding).toString(), -- cgit