From 99c95f0fe515a098a02b3700d383c81203bd3f7c Mon Sep 17 00:00:00 2001 From: Robert Lemke Date: Fri, 16 Aug 2019 10:20:53 +0200 Subject: [PATCH] Throw exception on start if bucket name is missing --- Classes/GcsStorage.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Classes/GcsStorage.php b/Classes/GcsStorage.php index c2c9df9..794e8df 100644 --- a/Classes/GcsStorage.php +++ b/Classes/GcsStorage.php @@ -20,7 +20,6 @@ use Neos\Flow\ResourceManagement\PersistentResource; use Neos\Flow\ResourceManagement\ResourceManager; use Neos\Flow\ResourceManagement\ResourceRepository; -use Neos\Flow\ResourceManagement\Storage\Exception; use Neos\Flow\ResourceManagement\Storage\StorageObject; use Neos\Flow\ResourceManagement\Storage\WritableStorageInterface; use Neos\Flow\Utility\Environment; @@ -117,15 +116,19 @@ public function __construct($name, array $options = array()) } } } + + if (empty($this->bucketName)) { + throw new Exception(sprintf('No bucket name was specified in the configuration of the "%s" resource GcsStorage. Please check your settings.', $name), 1565942783); + } } /** * Initialize the Google Cloud Storage instance * * @return void - * @throws \Flownative\Google\CloudStorage\Exception + * @throws Exception */ - public function initializeObject() + public function initializeObject(): void { $this->storageClient = $this->storageFactory->create(); } @@ -169,7 +172,6 @@ public function getKeyPrefix() * @param string | resource $source The URI (or local path and filename) or the PHP resource stream to import the resource from * @param string $collectionName Name of the collection the new PersistentResource belongs to * @return PersistentResource A resource object representing the imported resource - * @throws \Neos\Flow\ResourceManagement\Storage\Exception */ public function importResource($source, $collectionName): PersistentResource {