ZF2-485: 'Statement could not be executed'


In pdo\statement, this exception message is totally useless. It could be for a whole variety of reasons that the pdo statement fails from an invalid query to a locked database. The errorinfo is fantastic / the errorcode a good second best. Please can something be done to make this message better.


Well it IS passing the PDO exception as the previous exception for exception chaining. (Geez, how many times can I say exception in a sentence). So the PDO's error code and message should be passed along in the chain and printed out in the stack trace right?

Besides that information all PDO\Statement really knows is that the execution failed. IDK, I think the exception message is fine.

What do you think?

Try doing this:

try {
  //... something that fails
} catch (Exception $e) {
  $pdoException = $e->getPrevious();

If you are using the ZFSkeleton Application, it should be designed to show you any previous exceptions that might have occurred.

Interesting. It is there in the stack trace for web access, but I was working with console. which didn't display it