handle missing element

This commit is contained in:
Yisroel Baum 2026-05-26 19:47:58 +03:00
parent 1b05d4f1f5
commit 5e1ec0dd73
Signed by: yisroelbaum
GPG key ID: 0FA60884F75520A9

View file

@ -14,6 +14,11 @@ class ElementController
public function show(int $id): JsonResponse public function show(int $id): JsonResponse
{ {
$element = $this->elementRepository->find($id); $element = $this->elementRepository->find($id);
if ($element === null) {
return new JsonResponse([
'error' => 'Element not found',
], 404);
}
return new JsonResponse([ return new JsonResponse([
'element' => [ 'element' => [