From 4734ca5fe4ed02da5bc3e0df3c9ecbabc3474af3 Mon Sep 17 00:00:00 2001 From: Christopher Vagnetoft Date: Fri, 14 Mar 2025 15:34:28 +0100 Subject: [PATCH] Exceptions on request for missing group/slot --- src/SlotDbClient.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/SlotDbClient.php b/src/SlotDbClient.php index e24e40e..87d6c8e 100644 --- a/src/SlotDbClient.php +++ b/src/SlotDbClient.php @@ -50,6 +50,9 @@ class SlotDbClient public function querySlot(string $slotId): array { $res = $this->get("/slot/{$slotId}"); + if ($res->getStatusCode() == 404) { + throw new \RuntimeException("Invalid slot id"); + } $data = json_decode($res->getBody(), true); return $data; } @@ -119,6 +122,9 @@ class SlotDbClient public function queryGroup(string $groupId): array { $res = $this->get("/group/{$groupId}"); + if ($res->getStatusCode() == 404) { + throw new \RuntimeException("Invalid group id"); + } $data = json_decode($res->getBody(), true); return $data; }