Skip to content

Commit 2b16077

Browse files
fix express unhandled endpoints
1 parent ae38d86 commit 2b16077

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

components/server/src/express-util.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,10 @@ export function unhandledToError(req: express.Request, res: express.Response, ne
7373
if (isAnsweredRequest(req, res)) {
7474
return next();
7575
}
76-
return next(new Error("unhandled request: " + req.method + " " + req.originalUrl));
76+
// Instead of throwing an error, send a user-friendly response for unknown routes
77+
console.error("unhandled request: " + req.method + " " + req.originalUrl);
78+
res.status(404).send("Page not found");
79+
// return next(new Error("unhandled request: " + req.method + " " + req.originalUrl));
7780
}
7881

7982
/**

0 commit comments

Comments
 (0)