Skip to content
Snippets Groups Projects
Commit 383302d4 authored by Rhys Arkins's avatar Rhys Arkins
Browse files

refactor: info not warn if npm 401 response

parent 976f2ac5
No related branches found
No related tags found
No related merge requests found
......@@ -84,6 +84,10 @@ async function getDependency(name) {
logger.trace({ dep }, 'dep');
return dep;
} catch (err) {
if (err.statusCode === 401) {
logger.info({ err, name }, `Dependency lookup unauthorized`);
return null;
}
if (err.statusCode === 404) {
logger.info({ err, name }, `Dependency not found`);
return null;
......
......@@ -45,6 +45,13 @@ describe('api/npm', () => {
const res = await npm.getDependency('foobarhome');
expect(res).toMatchSnapshot();
});
it('should return null if lookup fails 401', async () => {
nock('https://registry.npmjs.org')
.get('/foobar')
.reply(401);
const res = await npm.getDependency('foobar');
expect(res).toBeNull();
});
it('should return null if lookup fails', async () => {
nock('https://registry.npmjs.org')
.get('/foobar')
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment