From 5e780a5f067476c1d207173fc9249faf9eaac0c2 Mon Sep 17 00:00:00 2001 From: Nathan LaFreniere Date: Thu, 17 Sep 2020 08:37:06 -0700 Subject: [PATCH] chore: remove unused spec parameter, assign error code --- lib/utils/get-identity.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/utils/get-identity.js b/lib/utils/get-identity.js index bf35f20305e01..d31b3ae28734f 100644 --- a/lib/utils/get-identity.js +++ b/lib/utils/get-identity.js @@ -4,10 +4,10 @@ const npm = require('../npm') const needsAuthError = (msg) => Object.assign(new Error(msg), { code: 'ENEEDAUTH' }) -module.exports = async (opts = {}, spec = null) => { +module.exports = async (opts = {}) => { const { registry } = opts if (!registry) { - throw new Error('no default registry set') + throw Object.assign(new Error('No registry specified.'), { code: 'ENOREGISTRY' }) } // First, check if we have a user/pass-based auth @@ -20,8 +20,7 @@ module.exports = async (opts = {}, spec = null) => { } else if (token) { // No username, but we have a token; fetch the username from registry const registryData = await npmFetch.json('/-/whoami', { - ...opts, - spec + ...opts }) const { username: usernameFromRegistry } = registryData // Retrieved username from registry; return it