From a326904825b6ec45612a9400f297babd02fcf921 Mon Sep 17 00:00:00 2001 From: Aldarien Date: Thu, 22 Dec 2022 22:24:55 -0300 Subject: [PATCH] Use exception in ResultSet --- src/Database/ResultSet.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/Database/ResultSet.php b/src/Database/ResultSet.php index dfe9aed..6654eb7 100644 --- a/src/Database/ResultSet.php +++ b/src/Database/ResultSet.php @@ -4,6 +4,7 @@ namespace ProVM\Database; use PDO; use PDOStatement; use ProVM\Concept\Database\ResultSet as RSInterface; +use ProVM\Exception\BlankResult; class ResultSet implements RSInterface { @@ -33,7 +34,7 @@ class ResultSet implements RSInterface { $rs = $this->getStatement()->fetchAll(PDO::FETCH_ASSOC); if (!$rs) { - throw new \PDOException("No results found."); + throw new BlankResult(); } return $rs; } @@ -41,7 +42,7 @@ class ResultSet implements RSInterface { $rs = $this->getStatement()->fetchAll(PDO::FETCH_OBJ); if (!$rs) { - throw new \PDOException("No results found."); + throw new BlankResult(); } return $rs; } @@ -49,7 +50,7 @@ class ResultSet implements RSInterface { $rs = $this->getStatement()->fetch(PDO::FETCH_ASSOC); if (!$rs or count($rs) === 0) { - throw new \PDOException("No results found."); + throw new BlankResult(); } return $rs; } @@ -57,7 +58,7 @@ class ResultSet implements RSInterface { $rs = $this->getStatement()->fetch(PDO::FETCH_OBJ); if (!$rs or count($rs) === 0) { - throw new \PDOException("No results found."); + throw new BlankResult(); } return $rs; }