Skip to content

Commit 5e780a5

Browse files
committed
chore: remove unused spec parameter, assign error code
1 parent 940e4a9 commit 5e780a5

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

lib/utils/get-identity.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ const npm = require('../npm')
44
const needsAuthError = (msg) =>
55
Object.assign(new Error(msg), { code: 'ENEEDAUTH' })
66

7-
module.exports = async (opts = {}, spec = null) => {
7+
module.exports = async (opts = {}) => {
88
const { registry } = opts
99
if (!registry) {
10-
throw new Error('no default registry set')
10+
throw Object.assign(new Error('No registry specified.'), { code: 'ENOREGISTRY' })
1111
}
1212

1313
// First, check if we have a user/pass-based auth
@@ -20,8 +20,7 @@ module.exports = async (opts = {}, spec = null) => {
2020
} else if (token) {
2121
// No username, but we have a token; fetch the username from registry
2222
const registryData = await npmFetch.json('/-/whoami', {
23-
...opts,
24-
spec
23+
...opts
2524
})
2625
const { username: usernameFromRegistry } = registryData
2726
// Retrieved username from registry; return it

0 commit comments

Comments
 (0)