Assuming that we're trying to catch all the possible exceptions within try ... catch block when persisting an object into database.

Handling exceptions

namespace Football\FrontendBundle\Controller;

use Doctrine\DBAL\DBALException;
use Doctrine\ORM\ORMException;
use PDOException;
use Exception;
use Football\FrontendBundle\Entity\Country;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;

class CountryController extends Controller
public function createAction()
$country = new Country();
$country->setName('United Kingdom');

$em = $this->getDoctrine()->getEntityManager();

try {
$message = 'Done';
} catch (DBALException $e) {
$message = sprintf('DBALException [%i]: %s', $e->getCode(), $e->getMessage());
} catch (PDOException $e) {
$message = sprintf('PDOException [%i]: %s', $e->getCode(), $e->getMessage());
} catch (ORMException $e) {
$message = sprintf('ORMException [%i]: %s', $e->getCode(), $e->getMessage());
} catch (Exception $e) {
$message = sprintf('Exception [%i]: %s', $e->getCode(), $e->getMessage());

echo $message;