Jira issue originally created by user hosiplan:
Is there any case when PDOException has it's own previous? I don't know of any. Even if it had one, it doesn't make sense because you're skipping one important!! piece in chain of exceptions that cause each other
Do you agree that the ->getPrevious() is wrong and should be removed? Should I send a pullrequest?
Comment created by @deeky666:
After having added the missing information from the wrapped \PDOException to Doctrine\DBAL\Driver\PDOException in commit:
all information from \PDOException should be retrievable from the Doctrine\DBAL\Driver\PDOException wrapper now. Therefore there should be no change in behaviour in existing applications.
[~hosiplan] Are you okay with the solution? Can this ticket be closed?
Comment created by hosiplan:
I disagree, first of all you're dropping a stack trace of that exception and replacing it with other from higher level, it may not be all that important, but all best practises say that you should always pass the exception to $previous.
There is zero disadvantages when keeping the exception in the chain. The few kilobytes of memory saved means nothing in comparision to backwards compatibility (which was broken without any real benefit).
Comment created by @ocramius:
I agree that the original PDOException should be passed in as $previous, since PDOExceptions themselves may or may not have a non-null getPrevious() result.
[~hosiplan] can you provide a pull request for that?
Yes I can! There you go #534 let me know if it needs any adjustments.
Comment created by @doctrinebot:
A related Github Pull-Request [GH-534] was closed:
Issue was closed with resolution "Fixed"
Thank you very much!