Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
renovate
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SmartDataLab
public
applications
renovate
Commits
369d9273
Unverified
Commit
369d9273
authored
2 years ago
by
Sergei Zharinov
Committed by
GitHub
2 years ago
Browse files
Options
Downloads
Patches
Plain Diff
fix(rubygems): Don't throw on metadata errors (#23224)
parent
e1ab6a72
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
lib/modules/datasource/rubygems/metadata-cache.spec.ts
+9
-4
9 additions, 4 deletions
lib/modules/datasource/rubygems/metadata-cache.spec.ts
lib/modules/datasource/rubygems/metadata-cache.ts
+5
-7
5 additions, 7 deletions
lib/modules/datasource/rubygems/metadata-cache.ts
with
14 additions
and
11 deletions
lib/modules/datasource/rubygems/metadata-cache.spec.ts
+
9
−
4
View file @
369d9273
...
@@ -192,7 +192,7 @@ describe('modules/datasource/rubygems/metadata-cache', () => {
...
@@ -192,7 +192,7 @@ describe('modules/datasource/rubygems/metadata-cache', () => {
});
});
});
});
it
(
'
throws
on unknown error
'
,
async
()
=>
{
it
(
'
returns fallback result
on unknown error
'
,
async
()
=>
{
const
cache
=
new
MetadataCache
(
new
Http
(
'
test
'
));
const
cache
=
new
MetadataCache
(
new
Http
(
'
test
'
));
httpMock
httpMock
...
@@ -201,9 +201,14 @@ describe('modules/datasource/rubygems/metadata-cache', () => {
...
@@ -201,9 +201,14 @@ describe('modules/datasource/rubygems/metadata-cache', () => {
.
reply
(
500
);
.
reply
(
500
);
const
versions
=
[
'
1
'
,
'
2
'
,
'
3
'
];
const
versions
=
[
'
1
'
,
'
2
'
,
'
3
'
];
const
res
=
await
cache
.
getRelease
(
'
https://rubygems.org
'
,
'
foobar
'
,
versions
);
await
expect
(
expect
(
res
).
toEqual
({
cache
.
getRelease
(
'
https://rubygems.org
'
,
'
foobar
'
,
versions
)
releases
:
[{
version
:
'
1
'
},
{
version
:
'
2
'
},
{
version
:
'
3
'
}],
).
rejects
.
toThrow
(
);
}
);
});
});
});
});
This diff is collapsed.
Click to expand it.
lib/modules/datasource/rubygems/metadata-cache.ts
+
5
−
7
View file @
369d9273
import
hasha
from
'
hasha
'
;
import
hasha
from
'
hasha
'
;
import
{
logger
}
from
'
../../../logger
'
;
import
*
as
packageCache
from
'
../../../util/cache/package
'
;
import
*
as
packageCache
from
'
../../../util/cache/package
'
;
import
{
Http
,
HttpError
}
from
'
../../../util/http
'
;
import
type
{
Http
}
from
'
../../../util/http
'
;
import
{
joinUrlParts
}
from
'
../../../util/url
'
;
import
{
joinUrlParts
}
from
'
../../../util/url
'
;
import
type
{
ReleaseResult
}
from
'
../types
'
;
import
type
{
ReleaseResult
}
from
'
../types
'
;
import
{
GemMetadata
,
GemVersions
}
from
'
./schema
'
;
import
{
GemMetadata
,
GemVersions
}
from
'
./schema
'
;
...
@@ -62,12 +63,9 @@ export class MetadataCache {
...
@@ -62,12 +63,9 @@ export class MetadataCache {
);
);
return
data
;
return
data
;
}
catch
(
err
)
{
}
catch
(
err
)
{
if
(
err
instanceof
HttpError
&&
err
.
response
?.
statusCode
===
404
)
{
logger
.
debug
({
err
},
'
Rubygems: failed to fetch metadata
'
);
const
releases
=
versions
.
map
((
version
)
=>
({
version
}));
const
releases
=
versions
.
map
((
version
)
=>
({
version
}));
return
{
releases
};
return
{
releases
};
}
}
throw
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