fix: add missing error handling in booking update
This commit is contained in:
@@ -86,15 +86,19 @@ class EditController extends AbstractController
|
|||||||
$form->handleRequest($request);
|
$form->handleRequest($request);
|
||||||
|
|
||||||
if ($form->isSubmitted() && $form->isValid()) {
|
if ($form->isSubmitted() && $form->isValid()) {
|
||||||
$this->apiClient->updateBooking($formData);
|
$response = $this->apiClient->updateBooking($formData);
|
||||||
|
|
||||||
try {
|
if (false === $response->isSuccessful()) {
|
||||||
$this->cache->delete($cacheKey);
|
$this->addFlash('error', $response->message);
|
||||||
} catch (InvalidArgumentException $e) {
|
} 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]);
|
return $this->redirectToRoute('app_booking_edit', ['id' => $id]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user