Skip to content

Commit

Permalink
fix(errors): Unknown auth errors use default code
Browse files Browse the repository at this point in the history
If we can't identify the auth problem we should pass it through with default settings. (This was an error in the npm-profile implementation.)
  • Loading branch information
iarna committed Mar 15, 2018
1 parent 073869b commit fea9627
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 2 deletions.
1 change: 0 additions & 1 deletion errors.js
Expand Up @@ -52,7 +52,6 @@ class HttpErrorAuthUnknown extends HttpErrorBase {
constructor (method, res, body, spec) {
super(method, res, body, spec)
this.message = 'Unable to authenticate, need: ' + res.headers.get('www-authenticate')
this.code = 'EAUTHUNOWN'
Error.captureStackTrace(this, HttpErrorAuthUnknown)
}
}
Expand Down
2 changes: 1 addition & 1 deletion test/errors.js
Expand Up @@ -117,7 +117,7 @@ test('Unexpected www-authenticate error', t => {
() => { throw new Error('Should not have succeeded!') },
err => {
t.match(err.body.error, /Pat-a-cake/ig, 'error body explains it')
t.equal(err.code, 'EAUTHUNOWN', 'got a special pokemon')
t.equal(err.code, 'E401', 'Unknown auth errors are generic 401s')
}
)
})
Expand Down

0 comments on commit fea9627

Please sign in to comment.