mirror of
https://github.com/tdurieux/anonymous_github.git
synced 2026-05-24 18:14:03 +02:00
Display error messages
This commit is contained in:
+2
-1
@@ -23,6 +23,7 @@ async function anonymizeRepository(options) {
|
||||
console.log("The repository is expired");
|
||||
await repoUtils.updateStatus(repoConfig, "expired");
|
||||
await repoUtils.removeRepository(repoConfig);
|
||||
throw "repository_expired";
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -150,7 +151,7 @@ router.get("/:repoId/file/:path*", async (req, res) => {
|
||||
);
|
||||
return res.sendFile(ppath, { dotfiles: "allow" });
|
||||
} else {
|
||||
return res.status(404).send({ error: "file_not_found" });
|
||||
return res.status(404).json({ error: "file_not_found" });
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
|
||||
+2
-2
@@ -277,7 +277,7 @@ router.post("/", async (req, res) => {
|
||||
if (repoConfig.options.mode == "download") {
|
||||
// details.size is in kilobytes
|
||||
if (details.size > config.MAX_REPO_SIZE) {
|
||||
return res.status(500).send({ error: "invalid_mode" });
|
||||
return res.status(500).send({ error: "non_supported_mode" });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -326,7 +326,7 @@ router.post("/", async (req, res) => {
|
||||
await repoUtils.updateStatus(repoConfig, "error");
|
||||
return res
|
||||
.status(500)
|
||||
.json({ error: "unable_to_access", message: error.message });
|
||||
.json({ error: "unable_to_anonymize", message: error.message });
|
||||
}
|
||||
res.send("ok");
|
||||
});
|
||||
|
||||
+1
-1
@@ -60,7 +60,7 @@ router.get("/all_repositories", async (req, res) => {
|
||||
{ projection: { repositories: 1 } }
|
||||
);
|
||||
if (!user) {
|
||||
res.status(401).send("User not found");
|
||||
res.status(401).send({error: "user_not_found"});
|
||||
}
|
||||
if (user.repositories && req.query.force !== "1") {
|
||||
return res.json(user.repositories);
|
||||
|
||||
+1
-1
@@ -62,7 +62,7 @@ async function webView(req, res) {
|
||||
console.error(error);
|
||||
return res.status(500).send({ error });
|
||||
}
|
||||
return res.status(404).send("File_not_found");
|
||||
return res.status(404).send("file_not_found");
|
||||
}
|
||||
|
||||
router.get("/:repoId/*", webView);
|
||||
|
||||
Reference in New Issue
Block a user