Exceptions on request for missing group/slot
This commit is contained in:
@ -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;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user