Skip to content

Commit

Permalink
fix(errors): Unknown auth errors use default code (#1)
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 authored and zkat committed Mar 16, 2018
1 parent 1286e31 commit 3d91b93
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 2 deletions.
1 change: 0 additions & 1 deletion errors.js
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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 3d91b93

Please # to comment.