ZF3 + Doctrine - how to retreive MySQL error?


I have an EntityManager (PilotManager class) and function:

 * Entity manager
 * @var Doctrine\ORM\EntityManager;
private $entityManager;

 * Constructor
public function __construct($entityManager)
    $this->entityManager = $entityManager;

public function addNewPilot($data)
    // Create new Pilot entity
    $pil = new Pilot();

    // Add the entity to entity manager

    // Apply changes to database
    echo 'x';

    return $pil;

And something goes wrong while doing ->flush(), script stops on this command, but I don’t see any error in log and on stdout (however it’s configured and I can see any other errors, warnings and notices).

How can I receive SQL error and avoid script to return 200 (returns it now)?

Doctrine ORM throws exceptions if there was an SQL-level error: you don’t get any output or return value on failures.