[GitHub] Error message customisation for all status codes (#1888)

This commit is contained in:
Pyves
2018-08-14 18:57:24 +01:00
committed by GitHub
parent b0f1d99e13
commit b0070ff861
12 changed files with 136 additions and 83 deletions

View File

@@ -22,14 +22,14 @@ function checkErrorResponse(
badgeData,
err,
res,
notFoundMessage = 'repo not found'
notFoundMessage = 'repo not found',
errorMessages = {}
) {
if (res && res.statusCode === 422) {
badgeData.text[1] = notFoundMessage
badgeData.colorscheme = 'lightgrey'
return true
}
return standardCheckErrorResponse(badgeData, err, res, notFoundMessage)
return standardCheckErrorResponse(badgeData, err, res, {
...errorMessages,
404: notFoundMessage,
422: notFoundMessage,
})
}
const commentsColor = colorScale([1, 3, 10, 25], undefined, true)