Skip to content

Commit

Permalink
scrape.js: Catch exception for GitHub GraphQL
Browse files Browse the repository at this point in the history
Fixes coala#163
  • Loading branch information
li-boxuan committed Oct 26, 2018
1 parent 6bd0c2d commit 5a451b6
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/scrape.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,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 => ({
Expand Down

0 comments on commit 5a451b6

Please sign in to comment.