33namespace Doctrine\DBAL\Driver;
44
55use Doctrine\DBAL\Driver\Connection as ConnectionInterface;
6- use Doctrine\DBAL\Driver\PDO\Exception;
76use Doctrine\DBAL\Driver\PDO\Statement;
87use PDO;
9- use PDOException;
8+ use PDOException as OriginalPDOException ;
109use PDOStatement;
1110
1211use function assert;
@@ -36,8 +35,8 @@ public function __construct($dsn, $user = null, $password = null, ?array $option
3635 parent::__construct($dsn, (string) $user, (string) $password, (array) $options);
3736 $this->setAttribute(PDO::ATTR_STATEMENT_CLASS, [Statement::class, []]);
3837 $this->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
39- } catch (PDOException $exception) {
40- throw Exception ::new($exception);
38+ } catch (OriginalPDOException $exception) {
39+ throw PDOException ::new($exception);
4140 }
4241 }
4342
@@ -51,8 +50,8 @@ public function exec($sql)
5150 assert($result !== false);
5251
5352 return $result;
54- } catch (PDOException $exception) {
55- throw Exception ::new($exception);
53+ } catch (OriginalPDOException $exception) {
54+ throw PDOException ::new($exception);
5655 }
5756 }
5857
@@ -77,8 +76,8 @@ public function prepare($sql, $driverOptions = [])
7776 assert($statement instanceof PDOStatement);
7877
7978 return $statement;
80- } catch (PDOException $exception) {
81- throw Exception ::new($exception);
79+ } catch (OriginalPDOException $exception) {
80+ throw PDOException ::new($exception);
8281 }
8382 }
8483
@@ -96,8 +95,8 @@ public function query()
9695 assert($stmt instanceof PDOStatement);
9796
9897 return $stmt;
99- } catch (PDOException $exception) {
100- throw Exception ::new($exception);
98+ } catch (OriginalPDOException $exception) {
99+ throw PDOException ::new($exception);
101100 }
102101 }
103102
@@ -112,8 +111,8 @@ public function lastInsertId($name = null)
112111 }
113112
114113 return parent::lastInsertId($name);
115- } catch (PDOException $exception) {
116- throw Exception ::new($exception);
114+ } catch (OriginalPDOException $exception) {
115+ throw PDOException ::new($exception);
117116 }
118117 }
119118
0 commit comments