From 8bc47c39b21ec6928e1b8c22e6ce8e4dcb6f0e21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Scho=CC=88nthal?= Date: Thu, 6 Feb 2014 23:58:23 +0100 Subject: [PATCH 1/2] improved exception on generation failure --- Controller/ImagineController.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Controller/ImagineController.php b/Controller/ImagineController.php index c2979924d..7664ef749 100644 --- a/Controller/ImagineController.php +++ b/Controller/ImagineController.php @@ -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; @@ -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); From 2254970da7083a115fa737d30d23fb69033c244c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Scho=CC=88nthal?= Date: Fri, 7 Feb 2014 08:24:02 +0100 Subject: [PATCH 2/2] fixed exception --- Controller/ImagineController.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Controller/ImagineController.php b/Controller/ImagineController.php index 7664ef749..c92849b12 100644 --- a/Controller/ImagineController.php +++ b/Controller/ImagineController.php @@ -2,7 +2,6 @@ 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; @@ -60,8 +59,8 @@ public function filterAction(Request $request, $path, $filter) 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); + } catch (\Imagine\Exception\RuntimeException $e) { + throw new \RuntimeException(sprintf('Unable to create image for path "%s" and filter "%s". Message was "%s"', $path, $filter, $e->getMessage()), 0, $e); } if ($targetPath) {