[GitHub] Error message customisation for all status codes (#1888)
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user