Skip to content

Commit

Permalink
feat: add new forbidden 403 error code
Browse files Browse the repository at this point in the history
PR-URL: #234
Credit: @claudiahdz
Close: #234
Reviewed-by: @isaacs
  • Loading branch information
claudiahdz authored and isaacs committed Aug 20, 2019
1 parent b417aff commit 2f3b79b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/outdated.js
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@ function shouldUpdate (args, tree, dep, has, req, depth, pkgpath, opts, cb, type
var l = pickManifest(d, 'latest')
var m = pickManifest(d, req)
} catch (er) {
if (er.code === 'ETARGET') {
if (er.code === 'ETARGET' || er.code === 'E403') {
return skip(er)
} else {
return skip()
Expand Down
12 changes: 12 additions & 0 deletions lib/utils/error-message.js
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,18 @@ function errorMessage (er) {
detail.push(['notarget', msg.join('\n')])
break

case 'E403':
short.push(['403', er.message])
msg = [
'In most cases, you or one of your dependencies are requesting',
'a package version that is forbidden by your security policy.'
]
if (er.parent) {
msg.push("\nIt was specified as a dependency of '" + er.parent + "'\n")
}
detail.push(['403', msg.join('\n')])
break

case 'ENOTSUP':
if (er.required) {
short.push(['notsup', er.message])
Expand Down

0 comments on commit 2f3b79b

Please sign in to comment.