From: SleeplessOne1917 Date: Wed, 28 Jun 2023 20:44:26 +0000 (-0400) Subject: Return appropriate error codes (#1665) X-Git-Url: http://these/git/%7B%60%24%7BwebArchiveUrl%7D/%22%7B%7D/%22https:/nerdica.net/%7B?a=commitdiff_plain;h=ef66dfa6fd5aede53a3e5464ba531d7ff8d30960;p=lemmy-ui.git Return appropriate error codes (#1665) Co-authored-by: Dessalines --- diff --git a/src/server/handlers/catch-all-handler.tsx b/src/server/handlers/catch-all-handler.tsx index f22b8a1..d485429 100644 --- a/src/server/handlers/catch-all-handler.tsx +++ b/src/server/handlers/catch-all-handler.tsx @@ -75,7 +75,12 @@ export default async (req: Request, res: Response) => { routeData = await activeRoute.fetchInitialData(initialFetchReq); } + + if (!activeRoute) { + res.status(404); + } } else if (try_site.state === "failed") { + res.status(500); 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") { return res.redirect(`/signup`); } else { + res.status(500); errorPageData = getErrorPageData(new Error(error.msg), site); } }