From 9ba5deb3888b3278e172b91bc7f78ea4f7431b76 Mon Sep 17 00:00:00 2001 From: Matthew Peveler Date: Fri, 15 Jul 2022 10:41:41 -0400 Subject: [PATCH] Do not set code when recasting PDOException (#2101) --- src/Phinx/Db/Adapter/PdoAdapter.php | 2 +- src/Phinx/Db/Adapter/PostgresAdapter.php | 2 +- src/Phinx/Db/Adapter/SqlServerAdapter.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Phinx/Db/Adapter/PdoAdapter.php b/src/Phinx/Db/Adapter/PdoAdapter.php index 52ba4d77d..872950416 100644 --- a/src/Phinx/Db/Adapter/PdoAdapter.php +++ b/src/Phinx/Db/Adapter/PdoAdapter.php @@ -98,7 +98,7 @@ protected function createPdoConnection(string $dsn, ?string $username = null, ?s throw new InvalidArgumentException(sprintf( 'There was a problem connecting to the database: %s', $e->getMessage() - ), $e->getCode(), $e); + ), 0, $e); } return $db; diff --git a/src/Phinx/Db/Adapter/PostgresAdapter.php b/src/Phinx/Db/Adapter/PostgresAdapter.php index e220a53ed..c3e459bde 100644 --- a/src/Phinx/Db/Adapter/PostgresAdapter.php +++ b/src/Phinx/Db/Adapter/PostgresAdapter.php @@ -94,7 +94,7 @@ public function connect(): void } catch (PDOException $exception) { throw new InvalidArgumentException( sprintf('Schema does not exists: %s', $options['schema']), - $exception->getCode(), + 0, $exception ); } diff --git a/src/Phinx/Db/Adapter/SqlServerAdapter.php b/src/Phinx/Db/Adapter/SqlServerAdapter.php index 7565aa045..b72e0cc1c 100644 --- a/src/Phinx/Db/Adapter/SqlServerAdapter.php +++ b/src/Phinx/Db/Adapter/SqlServerAdapter.php @@ -152,7 +152,7 @@ protected function connectDblib(): void throw new InvalidArgumentException(sprintf( 'There was a problem connecting to the database: %s', $exception->getMessage() - )); + ), 0, $exception); } $this->setConnection($db);