This commit is contained in:
2026-03-02 22:07:39 +01:00
parent 6232afdc4e
commit e819673015
2 changed files with 12 additions and 3 deletions

View File

@@ -45,9 +45,18 @@ final class Database
return $pdo;
} catch (\PDOException $e) {
// In Prod würdest du loggen; hier minimal
http_response_code(500);
echo 'Database connection error.';
$env = defined('APP_ENV') ? APP_ENV : 'prod';
$dbDebug = defined('APP_DB_DEBUG') && APP_DB_DEBUG;
$details = 'Database connection error.';
if ($env !== 'prod' || $dbDebug) {
$details .= ' ' . $e->getMessage();
}
error_log('[DB] ' . $e->getMessage());
echo $details;
exit;
}
}