From 55339fb5771cf43ae638ae7d9513bcdb8943d2a3 Mon Sep 17 00:00:00 2001 From: tdurieux Date: Fri, 23 Apr 2021 19:53:15 +0200 Subject: [PATCH] improve error handling --- routes/repository.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/routes/repository.js b/routes/repository.js index 04ea0f8..d53166b 100644 --- a/routes/repository.js +++ b/routes/repository.js @@ -349,7 +349,12 @@ router.post("/", async (req, res) => { { upsert: true } ); 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(data); await repoUtils.updateStatus(repoConfig, "ready"); } catch (error) {