Add try catch for urlRewrite

This commit is contained in:
touffies
2013-12-11 21:03:31 +01:00
parent bc992811d4
commit 681ac83334

View File

@@ -28,6 +28,8 @@ use Propel\Runtime\ActiveQuery\ModelCriteria;
use Thelia\Core\Event\UpdatePositionEvent;
use Thelia\Core\Event\UpdateSeoEvent;
use Thelia\Exception\UrlRewritingException;
use Thelia\Form\Exception\FormValidationException;
use \Thelia\Model\Tools\UrlRewritingTrait;
class BaseAction
@@ -100,8 +102,12 @@ class BaseAction
->save()
;
// Update the rewriten URL, if required
$object->setRewrittenUrl($event->getLocale(), $event->getUrl());
// Update the rewritten URL, if required
try {
$object->setRewrittenUrl($event->getLocale(), $event->getUrl());
} catch(UrlRewritingException $e) {
throw new FormValidationException($e->getMessage(), $e->getCode());
}
return $object;
}