bugfix: actually return 404 when game not found

This commit is contained in:
Evan
2025-03-31 09:36:38 -07:00
parent 00d14cdd8d
commit 88fb2f414c
2 changed files with 4 additions and 1 deletions
+3
View File
@@ -172,9 +172,12 @@ async function fetchLobbies(): Promise<number> {
const fetchPromises = [];
for (const gameID of publicLobbyIDs) {
const controller = new AbortController();
setTimeout(() => controller.abort(), 5000); // 5 second timeout
const port = config.workerPort(gameID);
const promise = fetch(`http://localhost:${port}/api/game/${gameID}`, {
headers: { [config.adminHeader()]: config.adminToken() },
signal: controller.signal,
})
.then((resp) => resp.json())
.then((json) => {
+1 -1
View File
@@ -185,7 +185,7 @@ export function startWorker() {
const game = gm.game(req.params.id);
if (game == null) {
log.info(`lobby ${req.params.id} not found`);
return res.status(404);
return res.status(404).json({ error: "Game not found" });
}
res.json(game.gameInfo());
}),