Skip to content

Commit

Permalink
Merge pull request #79 from netgen/NGSTACK-517-handle-not-existing-re…
Browse files Browse the repository at this point in the history
…source

NGSTACK-517 handle not existing resource
  • Loading branch information
iherak authored Jun 18, 2021
2 parents 7c4ed0e + 01680aa commit 1a25654
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion RemoteMedia/Provider/Cloudinary/CloudinaryProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use Netgen\Bundle\RemoteMediaBundle\Exception\TransformationHandlerNotFoundException;
use Netgen\Bundle\RemoteMediaBundle\RemoteMedia\RemoteMediaProvider;
use Netgen\Bundle\RemoteMediaBundle\Core\FieldType\RemoteMedia\Variation;
use Cloudinary\Api\NotFound;
use Psr\Log\LoggerInterface;
use Symfony\Component\HttpFoundation\File\File;

Expand Down Expand Up @@ -321,7 +322,11 @@ public function getRemoteResource($resourceId, $resourceType = 'image')
return new Value();
}

$response = $this->gateway->get($resourceId, $resourceType);
try {
$response = $this->gateway->get($resourceId, $resourceType);
} catch (NotFound $e) {
return new Value();
}

if (empty($response)) {
return new Value();
Expand Down

0 comments on commit 1a25654

Please sign in to comment.