From ac34d0e5b836af9d04627ae6bdac5a787c025827 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20=C5=A0tancl?= Date: Sun, 20 Jan 2019 19:47:56 +0100 Subject: [PATCH] Better error handling (fix #5) --- src/StorageDrivers/RedisStorageDriver.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/StorageDrivers/RedisStorageDriver.php b/src/StorageDrivers/RedisStorageDriver.php index 5765cf39..b753f75c 100644 --- a/src/StorageDrivers/RedisStorageDriver.php +++ b/src/StorageDrivers/RedisStorageDriver.php @@ -55,7 +55,12 @@ class RedisStorageDriver implements StorageDriver public function deleteTenant(string $id): bool { - $domain = $this->getTenantById($id)['domain']; + try { + $domain = $this->getTenantById($id)['domain']; + } catch (\Throwable $th) { + throw new \Exception("No tenant with UUID $id exists."); + } + $this->redis->del("domains:$domain"); return (bool) $this->redis->del("tenants:$id"); }