Skip to content

Commit f611415

Browse files
committed
1 parent fb3bbb7 commit f611415

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

lib/audit.js

+10-2
Original file line numberDiff line numberDiff line change
@@ -189,8 +189,16 @@ function auditCmd (args, cb) {
189189
}).then((auditReport) => {
190190
return audit.submitForFullReport(auditReport)
191191
}).catch((err) => {
192-
if (err.statusCode === 404 || err.statusCode >= 500) {
193-
const ne = new Error(`Your configured registry (${opts.registry}) does not support audit requests.`)
192+
if (err.statusCode >= 400) {
193+
let msg
194+
if (err.statusCode === 401) {
195+
msg = `Either your login credentials are invalid or your registry (${opts.registry}) does not support audit.`
196+
} else if (err.statusCode === 404) {
197+
msg = `Your configured registry (${opts.registry}) does not support audit requests.`
198+
} else {
199+
msg = `Your configured registry (${opts.registry}) does not support audit requests, or the audit endpoint is temporarily unavailable.`
200+
}
201+
const ne = new Error(msg)
194202
ne.code = 'ENOAUDIT'
195203
ne.wrapped = err
196204
throw ne

0 commit comments

Comments
 (0)