mirror of
https://github.com/renovatebot/renovate.git
synced 2025-01-11 14:36:25 +00:00
fix(gitlab): throw platform-failure if 5xx
This commit is contained in:
parent
6a11d5f59b
commit
f6f7db8d6c
2 changed files with 20 additions and 12 deletions
|
@ -13,20 +13,28 @@ async function get(path: string, options: any) {
|
|||
json: true,
|
||||
...options,
|
||||
};
|
||||
|
||||
const res = await got(path, opts);
|
||||
if (opts.paginate) {
|
||||
// Check if result is paginated
|
||||
try {
|
||||
const linkHeader = parseLinkHeader(res.headers.link as string);
|
||||
if (linkHeader && linkHeader.next) {
|
||||
res.body = res.body.concat((await get(linkHeader.next.url, opts)).body);
|
||||
try {
|
||||
const res = await got(path, opts);
|
||||
if (opts.paginate) {
|
||||
// Check if result is paginated
|
||||
try {
|
||||
const linkHeader = parseLinkHeader(res.headers.link as string);
|
||||
if (linkHeader && linkHeader.next) {
|
||||
res.body = res.body.concat(
|
||||
(await get(linkHeader.next.url, opts)).body
|
||||
);
|
||||
}
|
||||
} catch (err) /* istanbul ignore next */ {
|
||||
logger.warn({ err }, 'Pagination error');
|
||||
}
|
||||
} catch (err) /* istanbul ignore next */ {
|
||||
logger.warn({ err }, 'Pagination error');
|
||||
}
|
||||
return res;
|
||||
} catch (err) /* istanbul ignore next */ {
|
||||
if (err.statusCode >= 500 && err.statusCode < 600) {
|
||||
throw new Error('platform-failure');
|
||||
}
|
||||
throw err;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
const helpers = ['get', 'post', 'put', 'patch', 'head', 'delete'];
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
const util = require('util');
|
||||
const glob = util.promisify(require('glob'));
|
||||
|
||||
const ignoredExtensions = ['js', 'ts', 'md', 'pyc'];
|
||||
const ignoredExtensions = ['js', 'ts', 'md', 'pyc', 'DS_Store'];
|
||||
|
||||
function filterFiles(files) {
|
||||
return files.filter(file =>
|
||||
|
|
Loading…
Reference in a new issue