Phalcon,pdo_mysql在保存数据时无法处理Duplicate Entry

I have a database with a UNIQUE column contraint where im inserting rows from an old database, where this contraint dosen't exists.

I want to identify the rows causing the problem, and right now thats no problem since its development data, but when the system is in production I would like a generic handlering of duplicate entry error.

Right now I get a \Phalcon\Db\Exception with no useful info (exception code is 0, and the exception message is just the query, not the / a duplication error) which means I can't detect mysql 1062 duplication error code.

If I could catch a \Phalcon\Db\Exception with exception code like Phalcon_DUP_ERR or something inorder to identify that a 1062 mysql error occured, then thats what I want todo, but just don't know howto.

Am I doing anything wrong here, tried browsing the Phalcon documentation, but can't find anything about handling mysql errors?

In 0.5.0 the error mode for exceptions was ERRMODE_SILENT. That mode is less than useful, some errors are suddenly silent (even warnings). In 0.5.1, error mode was change to ERRMODE_EXCEPTION that will provide you better information.