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

fix(gitFs): rewrite git 5xx errors to platform-failure

parent a6a6e472
No related branches found
No related tags found
No related merge requests found
......@@ -120,6 +120,16 @@ async function handleError(config, err) {
delete config.branchList; // eslint-disable-line no-param-reassign
return err.message;
}
if (
err.message.includes('unable to access') &&
err.message.includes('The requested URL returned error: 5')
) {
logger.debug({ err }, 'git 5xx error');
logger.warn('Git error - aborting');
delete config.branchList; // eslint-disable-line no-param-reassign
// rewrite this error
return 'platform-failure';
}
// Swallow this error so that other repositories can be processed
logger.error({ err }, `Repository has unknown error`);
// delete branchList to avoid cleaning up branches
......
......@@ -41,6 +41,13 @@ describe('workers/repository/error', () => {
expect(res).toEqual(err);
});
});
it('rewrites git error', async () => {
const gitError = new Error(
"fatal: unable to access 'https://**redacted**@gitlab.com/learnox/learnox.git/': The requested URL returned error: 500\n"
);
const res = await handleError(config, gitError);
expect(res).toEqual('platform-failure');
});
it('handles unknown error', async () => {
const res = await handleError(config, new Error('abcdefg'));
expect(res).toEqual('unknown-error');
......
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