fix: catch travel data not found errors to show proper flash message
This commit is contained in:
@@ -10,6 +10,7 @@ use App\BusProNet\Exception\TimeoutException;
|
|||||||
use App\BusProNet\Model\Notification;
|
use App\BusProNet\Model\Notification;
|
||||||
use App\Controller\Booking\Traits;
|
use App\Controller\Booking\Traits;
|
||||||
use App\Controller\Booking\Traits\BookingExceptionHandlerTrait;
|
use App\Controller\Booking\Traits\BookingExceptionHandlerTrait;
|
||||||
|
use App\Exception\TravelNotFoundException;
|
||||||
use App\Entity\User;
|
use App\Entity\User;
|
||||||
use App\Form\BookingEditType;
|
use App\Form\BookingEditType;
|
||||||
use App\Form\BookingParticipantType;
|
use App\Form\BookingParticipantType;
|
||||||
@@ -71,7 +72,13 @@ class IndexController extends AbstractController
|
|||||||
$password = $this->crypt->decrypt($user->getPassword());
|
$password = $this->crypt->decrypt($user->getPassword());
|
||||||
|
|
||||||
// Load form data from session (or API on first load)
|
// Load form data from session (or API on first load)
|
||||||
$bookingDto = $this->dataLoader->loadFormData($request, $id, $email, $password);
|
try {
|
||||||
|
$bookingDto = $this->dataLoader->loadFormData($request, $id, $email, $password);
|
||||||
|
} catch (TravelNotFoundException) {
|
||||||
|
$this->addFlash('error', 'Reisedaten sind nicht (mehr) verfügbar');
|
||||||
|
|
||||||
|
return $this->redirectToRoute('app_bookings');
|
||||||
|
}
|
||||||
|
|
||||||
if (null === $bookingDto) {
|
if (null === $bookingDto) {
|
||||||
$this->addFlash('error', 'Buchungsdaten nicht (mehr) verfügbar');
|
$this->addFlash('error', 'Buchungsdaten nicht (mehr) verfügbar');
|
||||||
|
|||||||
Reference in New Issue
Block a user