Permalink
Browse files

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

[DBAL-813] Original PDOException is preserved
  • Loading branch information...
Ocramius committed Feb 23, 2014
2 parents 3c3a4b1 + 8d70cc7 commit 646edacd87d5b9d201bf19aaf55ee0e4d5e470c2
@@ -49,7 +49,7 @@ class PDOException extends \PDOException implements DriverException
*/
public function __construct(\PDOException $exception)
{
- parent::__construct($exception->getMessage(), 0, $exception->getPrevious());
+ parent::__construct($exception->getMessage(), 0, $exception);
$this->code = $exception->getCode();
$this->errorInfo = $exception->errorInfo;
@@ -63,4 +63,9 @@ public function testReturnsSQLState()
{
$this->assertSame(self::SQLSTATE, $this->exception->getSQLState());
}
+
+ public function testOriginalExceptionIsInChain()
+ {
+ $this->assertSame($this->wrappedExceptionMock, $this->exception->getPrevious());
+ }
}

0 comments on commit 646edac

Please sign in to comment.