Skip to content

Commit b39e0ee

Browse files
committed
throw exception on mysql error
Signed-off-by: Derek Smart <derek@grindaga.com>
1 parent 57b0d6b commit b39e0ee

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/PHPRed.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ public function __construct(\mysqli $mysqli)
1313
protected function query(string $query) : array
1414
{
1515
$results = $this->mysqli->query($query);
16+
if ($this->mysqli->errno) {
17+
throw new \Exception($this->mysqli->error);
18+
}
1619
if ($results->num_rows == 0) {
1720
throw new \Exception("No records found.");
1821
}

0 commit comments

Comments
 (0)