mirror of
https://github.com/all-contributors/cli.git
synced 2025-01-09 13:36:29 +00:00
fix: surface the message when the check api returns an error (#85)
This commit is contained in:
parent
687194c5f9
commit
ab41caa0c7
1 changed files with 4 additions and 3 deletions
|
@ -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)
|
||||
|
@ -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)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue