Skip to content

Commit 6c5b390

Browse files
committed
Removed PDOException error-code as it's not an integer which is what exceptions espect.
1 parent 340d789 commit 6c5b390

File tree

5 files changed

+8
-8
lines changed

5 files changed

+8
-8
lines changed

src/Pecee/Pixie/ConnectionAdapters/Mysql.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ protected function doConnect(array $config): PDO
4747
}
4848

4949
} catch (\PDOException $e) {
50-
throw new Exception($e->getMessage(), $e->getCode(), $e->getPrevious());
50+
throw new Exception($e->getMessage(), 0, $e->getPrevious());
5151
}
5252

5353
return $connection;

src/Pecee/Pixie/ConnectionAdapters/Pgsql.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ protected function doConnect(array $config): PDO
4343
}
4444

4545
} catch (\PDOException $e) {
46-
throw new Exception($e->getMessage(), $e->getCode(), $e->getPrevious());
46+
throw new Exception($e->getMessage(), 0, $e->getPrevious());
4747
}
4848

4949
return $connection;

src/Pecee/Pixie/ConnectionAdapters/Sqlite.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public function doConnect(array $config): PDO
2929
try {
3030
return new PDO($connectionString, null, null, $config['options']);
3131
} catch (\PDOException $e) {
32-
throw new Exception($e->getMessage(), $e->getCode(), $e->getPrevious());
32+
throw new Exception($e->getMessage(), 0, $e->getPrevious());
3333
}
3434
}
3535

src/Pecee/Pixie/QueryBuilder/QueryBuilderHandler.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1089,7 +1089,7 @@ public function statement(string $sql, array $bindings = []): array
10891089
try {
10901090
$pdoStatement->execute();
10911091
} catch (\PDOException $e) {
1092-
throw new Exception($e->getMessage(), $e->getCode(), $e->getPrevious(), $this->getLastQuery());
1092+
throw new Exception($e->getMessage(), 0, $e->getPrevious(), $this->getLastQuery());
10931093
}
10941094

10951095
return [$pdoStatement, \microtime(true) - $start];
@@ -1201,7 +1201,7 @@ public function transaction(\Closure $callback): Transaction
12011201
$this->pdo->rollBack();
12021202
}
12031203

1204-
throw new Exception($e->getMessage(), $e->getCode(), $e->getPrevious(), $this->getLastQuery());
1204+
throw new Exception($e->getMessage(), 0, $e->getPrevious(), $this->getLastQuery());
12051205
}
12061206

12071207
return $queryTransaction;

src/Pecee/Pixie/QueryBuilder/Transaction.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public function commit()
3636
try {
3737
$this->pdo->commit();
3838
} catch (\PDOException $e) {
39-
throw new Exception($e->getMessage(), $e->getCode(), $e->getPrevious(), $this->connection->getLastQuery());
39+
throw new Exception($e->getMessage(), 0, $e->getPrevious(), $this->connection->getLastQuery());
4040
}
4141

4242
throw new TransactionHaltException('Commit triggered transaction-halt.');
@@ -52,7 +52,7 @@ public function rollBack()
5252
try {
5353
$this->pdo->rollBack();
5454
} catch (\PDOException $e) {
55-
throw new Exception($e->getMessage(), $e->getCode(), $e->getPrevious(), $this->connection->getLastQuery());
55+
throw new Exception($e->getMessage(), 0, $e->getPrevious(), $this->connection->getLastQuery());
5656
}
5757

5858
throw new TransactionHaltException('Rollback triggered transaction-halt.');
@@ -78,7 +78,7 @@ public function statement(string $sql, array $bindings = []): array
7878
try {
7979
$this->transactionStatement->execute($bindings);
8080
} catch (\PDOException $e) {
81-
throw new Exception($e->getMessage(), $e->getCode(), $e->getPrevious(), $this->connection->getLastQuery());
81+
throw new Exception($e->getMessage(), 0, $e->getPrevious(), $this->connection->getLastQuery());
8282
}
8383

8484
return [$this->transactionStatement, microtime(true) - $start];

0 commit comments

Comments
 (0)