From f4b782438d6f79c179aa04761db5edd646e34379 Mon Sep 17 00:00:00 2001 From: Echron Date: Thu, 3 Mar 2022 01:33:30 +0000 Subject: [PATCH] Storage: improve response handling --- src/Endpoint/StorageEndpoint.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/Endpoint/StorageEndpoint.php b/src/Endpoint/StorageEndpoint.php index 6d80430..884289f 100644 --- a/src/Endpoint/StorageEndpoint.php +++ b/src/Endpoint/StorageEndpoint.php @@ -95,6 +95,9 @@ public function setItem(string $projectEnvironmentId, string $storageType, Stora if (isset($rawResult['data']) && isset($rawResult['data']['success'])) { return $rawResult['data']['success']; } + if (isset($rawResult['errors']) && count($rawResult['errors']) > 0) { + return false; + } throw new \Exception('Invalid response'); } @@ -136,7 +139,9 @@ public function deleteItem(string $projectEnvironmentId, string $storageType, st if (isset($rawItem['data']) && isset($rawItem['data']['success'])) { return $rawItem['data']['success']; } - + if (isset($rawResult['errors']) && count($rawResult['errors']) > 0) { + return false; + } throw new \Exception('Invalid response'); } @@ -188,7 +193,9 @@ public function clearPool(string $projectEnvironmentId, string $storageType, ?st if (isset($rawItem['data']) && isset($rawItem['data']['success'])) { return $rawItem['data']['success']; } - + if (isset($rawResult['errors']) && count($rawResult['errors']) > 0) { + return false; + } throw new \Exception('Invalid response'); } }