From d728b4ac2613b3dbe65170ba11a557b7c85d5d01 Mon Sep 17 00:00:00 2001
From: Rhys Arkins <rhys@arkins.net>
Date: Sun, 28 Oct 2018 08:13:27 +0100
Subject: [PATCH] fix(gitFs): try/catch/throw on clone error (#2700)

---
 lib/platform/git/storage.js | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/lib/platform/git/storage.js b/lib/platform/git/storage.js
index d8fd71d713..df13374f4b 100644
--- a/lib/platform/git/storage.js
+++ b/lib/platform/git/storage.js
@@ -89,7 +89,12 @@ class Storage {
         await fs.emptyDir(cwd);
         git = Git(cwd).silent(true);
         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 =
           Math.round(
             1 + 10 * convertHrtime(process.hrtime(cloneStart)).seconds
-- 
GitLab