Return appropriate error codes

This commit is contained in:
SleeplessOne1917 2023-06-28 00:45:34 -04:00
parent 314aa796c0
commit 0ea9b72242

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