From e50bf8606270a2d75fa7aa61312d69223eaac656 Mon Sep 17 00:00:00 2001 From: Lars Gebhardt-Kusche Date: Mon, 8 Dec 2025 01:10:49 +0100 Subject: [PATCH] asdsad --- src/ApiKernel.php | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/src/ApiKernel.php b/src/ApiKernel.php index dd29714..99bc3e0 100644 --- a/src/ApiKernel.php +++ b/src/ApiKernel.php @@ -1669,7 +1669,11 @@ class ApiKernel $customerId = (int)($user['customer_id'] ?? 0); if ($customerId <= 0) $this->fail('Customer context missing', null, 500); $table = $this->senderTable(); - $stmt = $this->pdo->prepare("SELECT * FROM `$table` WHERE `customer_id` = :cid ORDER BY `label` ASC"); + try { + $stmt = $this->pdo->prepare("SELECT * FROM `$table` WHERE `customer_id` = :cid ORDER BY `label` ASC"); + } catch (Throwable $e) { + $this->fail('Sender-Tabelle existiert nicht', $e->getMessage(), 500); + } $stmt->execute([':cid' => $customerId]); $items = []; while ($row = $stmt->fetch()) { @@ -1995,10 +1999,9 @@ class ApiKernel private function ensureCustomerSettingsTableExists(): void { $table = $this->customerSettingsTable(); - if ($this->tableExists($table)) { - return; - } - $sql = <<tableExists($table)) return; + try { + $sql = <<pdo->exec($sql); - $this->tableExistsCache[$table] = true; + $this->pdo->exec($sql); + $this->tableExistsCache[$table] = true; + } catch (Throwable $e) { + $this->fail('Customer-Settings Tabelle fehlt und konnte nicht erstellt werden', $e->getMessage(), 500); + } } private function generateToken(int $length = 48): string