Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
renovate
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
GitHub Mirror
Renovate Bot
renovate
Commits
93d475ee
Commit
93d475ee
authored
5 years ago
by
Rhys Arkins
Browse files
Options
Downloads
Patches
Plain Diff
fix(cdnjs): datasourceError on unknown error
parent
cbee46d0
Loading
Loading
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
lib/datasource/cdnjs/index.spec.ts
+7
-3
7 additions, 3 deletions
lib/datasource/cdnjs/index.spec.ts
lib/datasource/cdnjs/index.ts
+2
-2
2 additions, 2 deletions
lib/datasource/cdnjs/index.ts
with
9 additions
and
5 deletions
lib/datasource/cdnjs/index.spec.ts
+
7
−
3
View file @
93d475ee
...
...
@@ -45,9 +45,11 @@ describe('datasource/cdnjs', () => {
jest
.
clearAllMocks
();
return
global
.
renovateCache
.
rmAll
();
});
it
(
'
returns null
for empty result
'
,
async
()
=>
{
it
(
'
throws
for empty result
'
,
async
()
=>
{
got
.
mockResolvedValueOnce
(
null
);
expect
(
await
getPkgReleases
({
lookupName
:
'
foo/bar
'
})).
toBeNull
();
await
expect
(
getPkgReleases
({
lookupName
:
'
foo/bar
'
})
).
rejects
.
toThrowError
(
DATASOURCE_FAILURE
);
});
it
(
'
returns null for missing fields
'
,
async
()
=>
{
got
.
mockResolvedValueOnce
({});
...
...
@@ -77,7 +79,9 @@ describe('datasource/cdnjs', () => {
got
.
mockImplementationOnce
(()
=>
{
throw
new
Error
();
});
expect
(
await
getPkgReleases
({
lookupName
:
'
foo/bar
'
})).
toBeNull
();
await
expect
(
getPkgReleases
({
lookupName
:
'
foo/bar
'
})
).
rejects
.
toThrowError
(
DATASOURCE_FAILURE
);
});
it
(
'
returns null with wrong auth token
'
,
async
()
=>
{
got
.
mockRejectedValueOnce
({
statusCode
:
401
});
...
...
This diff is collapsed.
Click to expand it.
lib/datasource/cdnjs/index.ts
+
2
−
2
View file @
93d475ee
...
...
@@ -101,13 +101,13 @@ export async function getPkgReleases({
)
{
throw
new
DatasourceError
(
err
);
}
if
(
err
.
statusCode
===
401
)
{
logger
.
debug
(
errorData
,
'
Authorization error
'
);
}
else
if
(
err
.
statusCode
===
404
)
{
logger
.
debug
(
errorData
,
'
Package lookup error
'
);
}
else
{
logger
.
warn
(
errorData
,
'
CDNJS lookup failure: Unknown error
'
);
logger
.
debug
(
errorData
,
'
CDNJS lookup failure: Unknown error
'
);
throw
new
DatasourceError
(
err
);
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment