handle nullable pdf params

This commit is contained in:
Yisroel Baum 2026-06-26 10:09:50 +03:00
parent 9126b0e968
commit 8c8ee4c050
Signed by: yisroelbaum
GPG key ID: 0FA60884F75520A9
3 changed files with 18 additions and 4 deletions

View file

@ -69,8 +69,8 @@ class ElementController
}
public function showPdf(
string $folder,
string $fileName,
?string $folder,
?string $fileName,
): Response|JsonResponse {
try {
$result = $this->getElementPdf->execute(
@ -79,6 +79,10 @@ class ElementController
fileName: $fileName,
)
);
} catch (BadRequestException $exception) {
return new JsonResponse([
'error' => $exception->getMessage(),
], 400);
} catch (NotFoundException $exception) {
return new JsonResponse([
'error' => $exception->getMessage(),