]> Untitled Git - lemmy-ui.git/commitdiff
Return appropriate error codes (#1665)
authorSleeplessOne1917 <abias1122@gmail.com>
Wed, 28 Jun 2023 20:44:26 +0000 (16:44 -0400)
committerGitHub <noreply@github.com>
Wed, 28 Jun 2023 20:44:26 +0000 (16:44 -0400)
Co-authored-by: Dessalines <dessalines@users.noreply.github.com>
src/server/handlers/catch-all-handler.tsx

index f22b8a1734f55ed84475dc3d1bccb30045f9fd43..d485429cc032504a94e5d25ed12d956a5df7663b 100644 (file)
@@ -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);
       }
     }