improve error handling

This commit is contained in:
tdurieux
2021-08-13 08:26:27 +02:00
parent 290578967d
commit 38a189e980
6 changed files with 153 additions and 102 deletions
+3 -3
View File
@@ -11,17 +11,17 @@ async function webView(req: express.Request, res: express.Response) {
if (!repo) return;
try {
if (!repo.options.page) {
throw "page_not_activated";
throw new Error("page_not_activated");
}
if (!repo.options.pageSource) {
throw "page_not_activated";
throw new Error("page_not_activated");
}
if (
repo.options.pageSource?.branch !=
(repo.source as GitHubDownload).branch.name
) {
throw "page_not_supported_on_different_branch";
throw new Error("page_not_supported_on_different_branch");
}
let requestPath = path.join(