Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add new forbidden 403 error code #234

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
13 changes: 13 additions & 0 deletions lib/utils/error-message.js
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,19 @@ 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',
'please contact your npme admin.'
]
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