Exceptions on request for missing group/slot

This commit is contained in:
2025-03-14 15:34:28 +01:00
parent c85e36f1cb
commit 4734ca5fe4

View File

@ -50,6 +50,9 @@ class SlotDbClient
public function querySlot(string $slotId): array public function querySlot(string $slotId): array
{ {
$res = $this->get("/slot/{$slotId}"); $res = $this->get("/slot/{$slotId}");
if ($res->getStatusCode() == 404) {
throw new \RuntimeException("Invalid slot id");
}
$data = json_decode($res->getBody(), true); $data = json_decode($res->getBody(), true);
return $data; return $data;
} }
@ -119,6 +122,9 @@ class SlotDbClient
public function queryGroup(string $groupId): array public function queryGroup(string $groupId): array
{ {
$res = $this->get("/group/{$groupId}"); $res = $this->get("/group/{$groupId}");
if ($res->getStatusCode() == 404) {
throw new \RuntimeException("Invalid group id");
}
$data = json_decode($res->getBody(), true); $data = json_decode($res->getBody(), true);
return $data; return $data;
} }