Symfony2: captura a exceção no controlador e mostra a mensagem flash

try{
$em
= $this->getDoctrine()->getManager();
$em
->persist($entity);
$em
->flush();

$this
->get('session')->setFlash('notice', 'Article inserted!');
return $this->redirect($this->generateUrl('article_show', array('id' => $entity->getId())));
}catch(Exception $e){
// log $e->getMessage()
$this
->get('session')->setFlash('error', 'Can't insert the article.');
}


return $this->render('
MyTestBundle:Article:new.html.twig', array(
'
entity' => $entity,
'
form' => $form->createView(),
));