Skip to content

Commit

Permalink
Catch and throw errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Chuck Hagenbuch committed Sep 2, 2014
1 parent a45d044 commit 7eeb857
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions jonah/lib/Driver/Sql.php
Expand Up @@ -457,15 +457,19 @@ protected function _getStories($criteria, $order = Jonah::ORDER_PUBLISHED)
if ($limit || $start != 0) {
$results = array();
$rows = $this->_db->limitQuery($sql, $start, $limit, $values);
if ($rows instanceof PEAR_Error) {
throw new Jonah_Exception($rows);
}
while ($rows->fetchInto($row, DB_FETCHMODE_ASSOC)) {
$results[] = $row;
}
} else {
$results = $this->_db->getAll($sql, $values, DB_FETCHMODE_ASSOC);
if ($results instanceof PEAR_Error) {
throw new Jonah_Exception($results);
}
}
if ($results instanceof PEAR_Error) {
throw new Jonah_Exception($results);
}

foreach ($results as &$row) {
$row['tags'] = $this->readTags($row['id']);
}
Expand Down

0 comments on commit 7eeb857

Please sign in to comment.