From 2ea74bc25661ac8f20028555df1d268a780f0c9f Mon Sep 17 00:00:00 2001 From: Boxuan Li Date: Fri, 26 Oct 2018 22:36:11 +0800 Subject: [PATCH] scrape.js: Catch exception for GitHub GraphQL Fixes https://github.com/coala/gci-leaders/issues/163 --- lib/scrape.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/scrape.js b/lib/scrape.js index c35cac9..cbae581 100644 --- a/lib/scrape.js +++ b/lib/scrape.js @@ -132,7 +132,12 @@ async function fetchLeaders(id) { let repositoryInfo = {} async function fetchRepositoryInfo(org) { if (repositoryInfo[org]) return repositoryInfo[org] - const { data, errors } = await client.query(GITHUB_REPO_INFO_QUERY, { org }) + let data, errors + try { + ;({ data, errors } = await client.query(GITHUB_REPO_INFO_QUERY, { org })) + } catch (error) { + console.warn(`GitHub query for org ${org} fails, error: ${error}`) + } if (data && data.organization) { const info = data.organization.repositories.nodes.map(node => ({