fix: add missing error handling in booking update

This commit is contained in:
Björn Fromme
2025-01-26 20:34:10 +01:00
parent 93bd438e17
commit 427539481f
+10 -6
View File
@@ -86,15 +86,19 @@ class EditController extends AbstractController
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
$this->apiClient->updateBooking($formData);
$response = $this->apiClient->updateBooking($formData);
try {
$this->cache->delete($cacheKey);
} catch (InvalidArgumentException $e) {
if (false === $response->isSuccessful()) {
$this->addFlash('error', $response->message);
} else {
try {
$this->cache->delete($cacheKey);
} catch (InvalidArgumentException $e) {
}
$this->addFlash('success', 'Buchung erfolgreich aktualisiert');
}
$this->addFlash('success', 'Buchung erfolgreich aktualisiert');
return $this->redirectToRoute('app_booking_edit', ['id' => $id]);
}