[GITHUB] Badge for total stars of an user / org (#5507)

* added badge for total stars of an user / org
* Added a transformJson method in graphql-base to handle partial data


Co-authored-by: Pratapi Hemant Patel <pratpatel@expedia.com>
Co-authored-by: Caleb Cartwright <calebcartwright@users.noreply.github.com>
This commit is contained in:
Pratapi Hemant
2020-09-19 16:37:23 +05:30
committed by GitHub
parent 737254f4a5
commit 108a819c3a
5 changed files with 322 additions and 4 deletions

View File

@@ -24,9 +24,9 @@ function errorMessagesFor(notFoundMessage = 'repo not found') {
}
}
function transformErrors(errors) {
function transformErrors(errors, entity = 'repo') {
if (errors[0].type === 'NOT_FOUND') {
return new NotFound({ prettyMessage: 'repo not found' })
return new NotFound({ prettyMessage: `${entity} not found` })
} else {
return new InvalidResponse({ prettyMessage: errors[0].message })
}