33namespace Doctrine \DBAL \Driver ;
44
55use Doctrine \DBAL \Driver \Connection as ConnectionInterface ;
6+ use Doctrine \DBAL \Driver \PDO \Exception ;
67use Doctrine \DBAL \Driver \PDO \Statement ;
78use PDO ;
8- use PDOException as OriginalPDOException ;
9+ use PDOException ;
910use PDOStatement ;
1011
1112use function assert ;
@@ -35,8 +36,8 @@ public function __construct($dsn, $user = null, $password = null, ?array $option
3536 parent ::__construct ($ dsn , (string ) $ user , (string ) $ password , (array ) $ options );
3637 $ this ->setAttribute (PDO ::ATTR_STATEMENT_CLASS , [Statement::class, []]);
3738 $ this ->setAttribute (PDO ::ATTR_ERRMODE , PDO ::ERRMODE_EXCEPTION );
38- } catch (OriginalPDOException $ exception ) {
39- throw PDOException ::new ($ exception );
39+ } catch (PDOException $ exception ) {
40+ throw Exception ::new ($ exception );
4041 }
4142 }
4243
@@ -50,8 +51,8 @@ public function exec($sql)
5051 assert ($ result !== false );
5152
5253 return $ result ;
53- } catch (OriginalPDOException $ exception ) {
54- throw PDOException ::new ($ exception );
54+ } catch (PDOException $ exception ) {
55+ throw Exception ::new ($ exception );
5556 }
5657 }
5758
@@ -76,8 +77,8 @@ public function prepare($sql, $driverOptions = [])
7677 assert ($ statement instanceof PDOStatement);
7778
7879 return $ statement ;
79- } catch (OriginalPDOException $ exception ) {
80- throw PDOException ::new ($ exception );
80+ } catch (PDOException $ exception ) {
81+ throw Exception ::new ($ exception );
8182 }
8283 }
8384
@@ -95,8 +96,8 @@ public function query()
9596 assert ($ stmt instanceof PDOStatement);
9697
9798 return $ stmt ;
98- } catch (OriginalPDOException $ exception ) {
99- throw PDOException ::new ($ exception );
99+ } catch (PDOException $ exception ) {
100+ throw Exception ::new ($ exception );
100101 }
101102 }
102103
@@ -111,8 +112,8 @@ public function lastInsertId($name = null)
111112 }
112113
113114 return parent ::lastInsertId ($ name );
114- } catch (OriginalPDOException $ exception ) {
115- throw PDOException ::new ($ exception );
115+ } catch (PDOException $ exception ) {
116+ throw Exception ::new ($ exception );
116117 }
117118 }
118119
0 commit comments