Skip to content

Commit 3d91b93

Browse files
iarnazkat
authored andcommitted
fix(errors): Unknown auth errors use default code (#1)
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.)
1 parent 1286e31 commit 3d91b93

File tree

2 files changed

+1
-2
lines changed

2 files changed

+1
-2
lines changed

errors.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ class HttpErrorAuthUnknown extends HttpErrorBase {
5252
constructor (method, res, body, spec) {
5353
super(method, res, body, spec)
5454
this.message = 'Unable to authenticate, need: ' + res.headers.get('www-authenticate')
55-
this.code = 'EAUTHUNOWN'
5655
Error.captureStackTrace(this, HttpErrorAuthUnknown)
5756
}
5857
}

test/errors.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ test('Unexpected www-authenticate error', t => {
117117
() => { throw new Error('Should not have succeeded!') },
118118
err => {
119119
t.match(err.body.error, /Pat-a-cake/ig, 'error body explains it')
120-
t.equal(err.code, 'EAUTHUNOWN', 'got a special pokemon')
120+
t.equal(err.code, 'E401', 'Unknown auth errors are generic 401s')
121121
}
122122
)
123123
})

0 commit comments

Comments
 (0)