From 70c0ed12c3b74ff1e8043660853470f0dd148010 Mon Sep 17 00:00:00 2001 From: Greg Bowler Date: Thu, 8 Feb 2024 13:27:19 +0000 Subject: [PATCH] fix: work with non-integer error codes fixes #364 --- src/Query/SqlQuery.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Query/SqlQuery.php b/src/Query/SqlQuery.php index e950da5..f407f1e 100644 --- a/src/Query/SqlQuery.php +++ b/src/Query/SqlQuery.php @@ -71,10 +71,10 @@ public function execute(array $bindings = []):ResultSet { $lastInsertId = $pdo->lastInsertId(); } catch(PDOException $exception) { + $code = $exception->getCode(); throw new PreparedStatementException( - $exception->getMessage(), - $exception->getCode(), - $exception + $exception->getMessage() . " (Code $code)", + previous: $exception ); } }