improve error handling during anonymization

This commit is contained in:
tdurieux
2021-04-22 08:24:35 +02:00
parent 0ea31b8c7f
commit 517cf0ae53

View File

@@ -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 });
}
});