summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorDaniel Schaal <daniel@schaal.email>2016-11-18 16:03:31 +0100
committerBernhard Posselt <BernhardPosselt@users.noreply.github.com>2016-11-18 16:03:31 +0100
commitf658beaf61962686738946211101321e2dcf860c (patch)
treeb1b9177eb98ca635a92b2f62d0a585435365fc61 /lib
parent7183da78c620eba60b33a4c4ad7ea5b206b6a69e (diff)
Throw ServiceNotFoundException when marking non-existent item as read (#61)
* Throw ServiceNotFoundException when marking non-existent item as read Fixes #58 * Add test case for marking non-existent item as read
Diffstat (limited to 'lib')
-rw-r--r--lib/Service/ItemService.php8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/Service/ItemService.php b/lib/Service/ItemService.php
index fdf97c27b..f657b3eff 100644
--- a/lib/Service/ItemService.php
+++ b/lib/Service/ItemService.php
@@ -147,8 +147,12 @@ class ItemService extends Service {
* @throws ServiceNotFoundException if the item does not exist
*/
public function read($itemId, $isRead, $userId){
- $lastModified = $this->timeFactory->getMicroTime();
- $this->itemMapper->readItem($itemId, $isRead, $lastModified, $userId);
+ try {
+ $lastModified = $this->timeFactory->getMicroTime();
+ $this->itemMapper->readItem($itemId, $isRead, $lastModified, $userId);
+ } catch(DoesNotExistException $ex) {
+ throw new ServiceNotFoundException($ex->getMessage());
+ }
}