Skip to content

Commit

Permalink
Throw exception on start if bucket name is missing
Browse files Browse the repository at this point in the history
  • Loading branch information
robertlemke committed Aug 16, 2019
1 parent f9c7526 commit 99c95f0
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions Classes/GcsStorage.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
}
Expand Down Expand Up @@ -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
{
Expand Down

0 comments on commit 99c95f0

Please sign in to comment.