Skip to content
This repository was archived by the owner on Jan 9, 2025. It is now read-only.

Commit 77f278b

Browse files
committed
throwing proper exception
1 parent 9a048a5 commit 77f278b

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/PreparedQuery.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,12 @@ public function bindValue(string $name, mixed $value): void
2424
$result = $this->stmt->bindValue($name, $value);
2525

2626
if ($result === false) {
27-
throw new \Exception("Failed to bind value to query");
27+
[$sqlState, $errorCode, $errorMessage] = $this->stmt->errorInfo();
28+
throw new QueryException(
29+
$this,
30+
sprintf("Failed to bind value to query. Error %s: %s", $sqlState, $errorMessage),
31+
$errorCode
32+
);
2833
}
2934
}
3035

0 commit comments

Comments
 (0)