Skip to content

Commit 03a84d3

Browse files
authored
Catch correct exception type
1 parent 213f639 commit 03a84d3

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Http/Api/Controller.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ public function handleShowAction($id, $request, array $extraParams = [])
187187
try {
188188
$item = $this->repository->find($id, $fields);
189189
$this->authoriseUserAction('view', $item);
190-
} catch (\Exception $exception) {
190+
} catch (ModelNotFoundException $exception) {
191191
return $this->errorNotFound('Record not found');
192192
}
193193

@@ -264,7 +264,7 @@ public function handleDestroyAction($id, $request)
264264
$item = $this->repository->find($id);
265265
$this->authoriseUserAction('delete', $item);
266266
$item->delete();
267-
} catch (\Exception $exception) {
267+
} catch (ModelNotFoundException $exception) {
268268
return $this->errorNotFound('Record not found');
269269
}
270270

0 commit comments

Comments
 (0)