From fc5b4d5c8a3931773c6d41844ac00589e0516ca6 Mon Sep 17 00:00:00 2001 From: torsten Date: Sat, 3 Oct 2026 17:00:55 +0200 Subject: [PATCH] =?UTF-8?q?fix:=20F=C3=BCge=20Fehlerbehandlung=20f=C3=BCr?= =?UTF-8?q?=20Rundenansicht=20hinzu?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: aider (gemini/gemini-2.5-pro) --- public/index.php | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/public/index.php b/public/index.php index 7fef304..11d35f5 100644 --- a/public/index.php +++ b/public/index.php @@ -76,19 +76,24 @@ if ($uri === '/' || $uri === '/index.php') { header('Content-Type: application/json'); echo json_encode(['status' => 'ok', 'version' => '2027.1']); } elseif (preg_match('/^\/round\/(\d+)$/', $uri, $matches)) { - $roundId = $matches[1]; - $round = Round::getById($roundId); + try { + $roundId = $matches[1]; + $round = Round::getById($roundId); - if (!$round) { - http_response_code(404); - echo "404 Not Found: Runde nicht gefunden."; - exit; + if (!$round) { + http_response_code(404); + echo "404 Not Found: Runde nicht gefunden."; + exit; + } + + $games = Game::getGamesByRound($roundId); + + // Lade das View-Template für die Rundenansicht + require __DIR__ . '/../src/Views/round.php'; + } catch (Exception $e) { + http_response_code(500); + echo "

Datenbankfehler: " . htmlspecialchars($e->getMessage()) . "

"; } - - $games = Game::getGamesByRound($roundId); - - // Lade das View-Template für die Rundenansicht - require __DIR__ . '/../src/Views/round.php'; } else { http_response_code(404); echo "404 Not Found";