Commit 646edacd authored by Marco Pivetta's avatar Marco Pivetta

Merge pull request #534 from fprochazka/preserve-original-pdo-exception

[DBAL-813] Original PDOException is preserved
parents 3c3a4b14 8d70cc73
...@@ -49,7 +49,7 @@ class PDOException extends \PDOException implements DriverException ...@@ -49,7 +49,7 @@ class PDOException extends \PDOException implements DriverException
*/ */
public function __construct(\PDOException $exception) public function __construct(\PDOException $exception)
{ {
parent::__construct($exception->getMessage(), 0, $exception->getPrevious()); parent::__construct($exception->getMessage(), 0, $exception);
$this->code = $exception->getCode(); $this->code = $exception->getCode();
$this->errorInfo = $exception->errorInfo; $this->errorInfo = $exception->errorInfo;
......
...@@ -63,4 +63,9 @@ class PDOExceptionTest extends DbalTestCase ...@@ -63,4 +63,9 @@ class PDOExceptionTest extends DbalTestCase
{ {
$this->assertSame(self::SQLSTATE, $this->exception->getSQLState()); $this->assertSame(self::SQLSTATE, $this->exception->getSQLState());
} }
public function testOriginalExceptionIsInChain()
{
$this->assertSame($this->wrappedExceptionMock, $this->exception->getPrevious());
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment