handle missing element
This commit is contained in:
parent
1b05d4f1f5
commit
5e1ec0dd73
1 changed files with 5 additions and 0 deletions
|
|
@ -14,6 +14,11 @@ class ElementController
|
|||
public function show(int $id): JsonResponse
|
||||
{
|
||||
$element = $this->elementRepository->find($id);
|
||||
if ($element === null) {
|
||||
return new JsonResponse([
|
||||
'error' => 'Element not found',
|
||||
], 404);
|
||||
}
|
||||
|
||||
return new JsonResponse([
|
||||
'element' => [
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue