Skip to content

Commit 2f3b79b

Browse files
claudiahdzisaacs
authored andcommitted
feat: add new forbidden 403 error code
PR-URL: #234 Credit: @claudiahdz Close: #234 Reviewed-by: @isaacs
1 parent b417aff commit 2f3b79b

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

lib/outdated.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,7 @@ function shouldUpdate (args, tree, dep, has, req, depth, pkgpath, opts, cb, type
421421
var l = pickManifest(d, 'latest')
422422
var m = pickManifest(d, req)
423423
} catch (er) {
424-
if (er.code === 'ETARGET') {
424+
if (er.code === 'ETARGET' || er.code === 'E403') {
425425
return skip(er)
426426
} else {
427427
return skip()

lib/utils/error-message.js

+12
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,18 @@ function errorMessage (er) {
327327
detail.push(['notarget', msg.join('\n')])
328328
break
329329

330+
case 'E403':
331+
short.push(['403', er.message])
332+
msg = [
333+
'In most cases, you or one of your dependencies are requesting',
334+
'a package version that is forbidden by your security policy.'
335+
]
336+
if (er.parent) {
337+
msg.push("\nIt was specified as a dependency of '" + er.parent + "'\n")
338+
}
339+
detail.push(['403', msg.join('\n')])
340+
break
341+
330342
case 'ENOTSUP':
331343
if (er.required) {
332344
short.push(['notsup', er.message])

0 commit comments

Comments
 (0)