Skip to content

Commit

Permalink
improved exception on generation failure
Browse files Browse the repository at this point in the history
  • Loading branch information
digitalkaoz committed Feb 6, 2014
1 parent cb56b14 commit 8bc47c3
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions Controller/ImagineController.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Liip\ImagineBundle\Controller;

use Imagine\Exception\RuntimeException;
use Liip\ImagineBundle\Imagine\Cache\CacheManager;
use Liip\ImagineBundle\Imagine\Data\DataManager;
use Liip\ImagineBundle\Imagine\Filter\FilterManager;
Expand Down Expand Up @@ -56,8 +57,12 @@ public function filterAction(Request $request, $path, $filter)
return $targetPath;
}

$image = $this->dataManager->find($filter, $path);
$response = $this->filterManager->get($request, $filter, $image, $path);
try {
$image = $this->dataManager->find($filter, $path);
$response = $this->filterManager->get($request, $filter, $image, $path);
} catch (RuntimeException $e) {
throw new RuntimeException('unable to create image for '.$path.' error was: '.$e->getMessage(), 0, $e);
}

if ($targetPath) {
$response = $this->cacheManager->store($response, $targetPath, $filter);
Expand Down

0 comments on commit 8bc47c3

Please sign in to comment.