db up
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user