fix(gitFs): try/catch/throw on clone error (#2700)

This commit is contained in:
Rhys Arkins 2018-10-28 08:13:27 +01:00 committed by GitHub
parent 70415861cd
commit d728b4ac26
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -89,7 +89,12 @@ class Storage {
await fs.emptyDir(cwd); await fs.emptyDir(cwd);
git = Git(cwd).silent(true); git = Git(cwd).silent(true);
const cloneStart = process.hrtime(); const cloneStart = process.hrtime();
await git.clone(config.url, '.', ['--depth=2', '--no-single-branch']); try {
await git.clone(config.url, '.', ['--depth=2', '--no-single-branch']);
} catch (err) /* istanbul ignore next */ {
logger.debug({ err }, 'git clone error');
throw new Error('platform-failure');
}
const cloneSeconds = const cloneSeconds =
Math.round( Math.round(
1 + 10 * convertHrtime(process.hrtime(cloneStart)).seconds 1 + 10 * convertHrtime(process.hrtime(cloneStart)).seconds