Skip to content

Commit

Permalink
fix: surface the message when the check api returns an error (#85)
Browse files Browse the repository at this point in the history
  • Loading branch information
davidmenendez authored and machour committed Feb 23, 2018
1 parent 687194c commit ab41caa
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/util/check.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ function getContributorsPage(url) {
})
.then(res => {
const body = JSON.parse(res.body)
if (res.statusCode >= 400) {
throw new Error(body.message)
}
const contributorsIds = body.map(contributor => contributor.login)

const nextLink = getNextLink(res.headers.link)
Expand All @@ -39,8 +42,6 @@ function getContributorsPage(url) {
}

module.exports = function getContributorsFromGithub(owner, name) {
const url = `https://api.github.com/repos/${owner}/${
name
}/contributors?per_page=100`
const url = `https://api.github.com/repos/${owner}/${name}/contributors?per_page=100`
return getContributorsPage(url)
}

0 comments on commit ab41caa

Please sign in to comment.