Skip to content

Commit

Permalink
audit: report server error on failure
Browse files Browse the repository at this point in the history
  • Loading branch information
isaacs committed Jul 17, 2019
1 parent 74da180 commit e2d377b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ Unix systems.
* [`235e5d6df`](https://github.com/npm/cli/commit/235e5d6df6f427585ec58425f1f3339d08f39d8a)
ensure correct owner on cached all-packages metadata
([@isaacs](https://github.com/isaacs))
* [`fa6acd2ea`](https://github.com/npm/cli/commit/fa6acd2ea035bf26c04d7885b534d03d5b77e7ba)
[npm.community#8450](https://npm.community/t/npm-audit-fails-with-child-requires-fails-because-requires-must-be-an-object/8540)
audit: report server error on failure ([@isaacs](https://github.com/isaacs))

### DEPENDENCIES

Expand Down
5 changes: 4 additions & 1 deletion lib/audit.js
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,10 @@ function auditCmd (args, cb) {
} else if (err.statusCode === 404) {
msg = `Your configured registry (${opts.registry}) does not support audit requests.`
} else {
msg = `Your configured registry (${opts.registry}) does not support audit requests, or the audit endpoint is temporarily unavailable.`
msg = `Your configured registry (${opts.registry}) may not support audit requests, or the audit endpoint may be temporarily unavailable.`
}
if (err.body.length) {
msg += '\nThe server said: ' + err.body
}
const ne = new Error(msg)
ne.code = 'ENOAUDIT'
Expand Down

0 comments on commit e2d377b

Please sign in to comment.