Return appropriate error codes (#1665)

Co-authored-by: Dessalines <dessalines@users.noreply.github.com>
This commit is contained in:
SleeplessOne1917 2023-06-28 16:44:26 -04:00 committed by GitHub
parent 5c16be767c
commit ef66dfa6fd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -75,7 +75,12 @@ export default async (req: Request, res: Response) => {
routeData = await activeRoute.fetchInitialData(initialFetchReq); routeData = await activeRoute.fetchInitialData(initialFetchReq);
} }
if (!activeRoute) {
res.status(404);
}
} else if (try_site.state === "failed") { } else if (try_site.state === "failed") {
res.status(500);
errorPageData = getErrorPageData(new Error(try_site.msg), site); errorPageData = getErrorPageData(new Error(try_site.msg), site);
} }
@ -89,6 +94,7 @@ export default async (req: Request, res: Response) => {
if (error.msg === "instance_is_private") { if (error.msg === "instance_is_private") {
return res.redirect(`/signup`); return res.redirect(`/signup`);
} else { } else {
res.status(500);
errorPageData = getErrorPageData(new Error(error.msg), site); errorPageData = getErrorPageData(new Error(error.msg), site);
} }
} }