fix: Füge Fehlerbehandlung für Rundenansicht hinzu

Co-authored-by: aider (gemini/gemini-2.5-pro) <aider@aider.chat>
This commit is contained in:
torsten 2026-10-03 17:00:55 +02:00
parent 6d703b3deb
commit fc5b4d5c8a

View file

@ -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 "<p style='color:red;'>Datenbankfehler: " . htmlspecialchars($e->getMessage()) . "</p>";
}
$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";