mirror of
https://github.com/renovatebot/renovate.git
synced 2025-01-11 22:46:27 +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,
|
json: true,
|
||||||
...options,
|
...options,
|
||||||
};
|
};
|
||||||
|
try {
|
||||||
const res = await got(path, opts);
|
const res = await got(path, opts);
|
||||||
if (opts.paginate) {
|
if (opts.paginate) {
|
||||||
// Check if result is paginated
|
// Check if result is paginated
|
||||||
try {
|
try {
|
||||||
const linkHeader = parseLinkHeader(res.headers.link as string);
|
const linkHeader = parseLinkHeader(res.headers.link as string);
|
||||||
if (linkHeader && linkHeader.next) {
|
if (linkHeader && linkHeader.next) {
|
||||||
res.body = res.body.concat((await get(linkHeader.next.url, opts)).body);
|
res.body = res.body.concat(
|
||||||
|
(await get(linkHeader.next.url, opts)).body
|
||||||
|
);
|
||||||
}
|
}
|
||||||
} catch (err) /* istanbul ignore next */ {
|
} catch (err) /* istanbul ignore next */ {
|
||||||
logger.warn({ err }, 'Pagination error');
|
logger.warn({ err }, 'Pagination error');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
|
} catch (err) /* istanbul ignore next */ {
|
||||||
|
if (err.statusCode >= 500 && err.statusCode < 600) {
|
||||||
|
throw new Error('platform-failure');
|
||||||
|
}
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const helpers = ['get', 'post', 'put', 'patch', 'head', 'delete'];
|
const helpers = ['get', 'post', 'put', 'patch', 'head', 'delete'];
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
const util = require('util');
|
const util = require('util');
|
||||||
const glob = util.promisify(require('glob'));
|
const glob = util.promisify(require('glob'));
|
||||||
|
|
||||||
const ignoredExtensions = ['js', 'ts', 'md', 'pyc'];
|
const ignoredExtensions = ['js', 'ts', 'md', 'pyc', 'DS_Store'];
|
||||||
|
|
||||||
function filterFiles(files) {
|
function filterFiles(files) {
|
||||||
return files.filter(file =>
|
return files.filter(file =>
|
||||||
|
|
Loading…
Reference in a new issue