mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-06-21 13:10:42 +00:00
bugfix: actually return 404 when game not found
This commit is contained in:
@@ -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) => {
|
||||
|
||||
@@ -187,7 +187,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());
|
||||
}),
|
||||
|
||||
Reference in New Issue
Block a user