From 517cf0ae531a60b5d2d9d70b9c6cf9b1919a0d0a Mon Sep 17 00:00:00 2001 From: tdurieux Date: Thu, 22 Apr 2021 08:24:35 +0200 Subject: [PATCH] improve error handling during anonymization --- routes/repository.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/routes/repository.js b/routes/repository.js index 4594f3e..5ee2348 100644 --- a/routes/repository.js +++ b/routes/repository.js @@ -116,13 +116,17 @@ router.post("/:repoId/", async (req, res) => { await repoUtils.updateStatus(repoConfig, "preparing"); res.send("ok"); - + } catch (error) { + console.error(req.path, error); + await repoUtils.updateStatus(repoConfig, "error", error); + return res.status(500).json({ error }); + } + try { await githubUtils.downloadRepoAndAnonymize(repoConfig); await repoUtils.updateStatus(repoConfig, "ready"); } catch (error) { console.error(req.path, error); await repoUtils.updateStatus(repoConfig, "error", error); - return res.status(500).json({ error }); } });