Handle qb mapper exception messages properly

Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
Julius Härtl
2022-04-29 15:45:07 +02:00
committed by backportbot-nextcloud[bot]
parent ad4174f6bd
commit 5214377341

View File

@@ -67,13 +67,13 @@ class AttachmentMapper extends DeckMapper implements IPermissionMapper {
$row = $cursor->fetch(PDO::FETCH_ASSOC);
if ($row === false) {
$cursor->closeCursor();
throw new DoesNotExistException('Did expect one result but found none when executing' . $qb);
throw new DoesNotExistException('Did expect one result but found none when executing query: ' . $qb->getSQL());
}
$row2 = $cursor->fetch();
$cursor->closeCursor();
if ($row2 !== false) {
throw new MultipleObjectsReturnedException('Did not expect more than one result when executing' . $query);
throw new MultipleObjectsReturnedException('Did not expect more than one result when executing query: ' . $qb->getSQL());
}
return $this->mapRowToEntity($row);
@@ -89,7 +89,7 @@ class AttachmentMapper extends DeckMapper implements IPermissionMapper {
$row = $cursor->fetch(PDO::FETCH_ASSOC);
if ($row === false) {
$cursor->closeCursor();
throw new DoesNotExistException('Did expect one result but found none when executing' . $qb);
throw new DoesNotExistException('Did expect one result but found none when executing query: ' . $qb->getSQL());
}
$cursor->closeCursor();
return $this->mapRowToEntity($row);