fix: catch travel data not found errors to show proper flash message

This commit is contained in:
Björn Fromme
2025-12-19 17:54:25 +01:00
parent cd350c212e
commit c9426eff3b
@@ -10,6 +10,7 @@ use App\BusProNet\Exception\TimeoutException;
use App\BusProNet\Model\Notification;
use App\Controller\Booking\Traits;
use App\Controller\Booking\Traits\BookingExceptionHandlerTrait;
use App\Exception\TravelNotFoundException;
use App\Entity\User;
use App\Form\BookingEditType;
use App\Form\BookingParticipantType;
@@ -71,7 +72,13 @@ class IndexController extends AbstractController
$password = $this->crypt->decrypt($user->getPassword());
// 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) {
$this->addFlash('error', 'Buchungsdaten nicht (mehr) verfügbar');