getOrCreateBookingCreateDto($request); } catch (BookingSessionNotFoundException $e) { $this->addFlash('error', 'Deine Buchungssitzung ist abgelaufen. Bitte starte eine neue Buchung.'); return $this->redirectToRoute('app_booking_create_error'); } catch (TravelNotFoundException $e) { $this->addFlash('error', 'Die angeforderte Reise wurde nicht gefunden.'); return $this->redirectToRoute('app_booking_create_error'); } catch (HotelNotFoundException $e) { $this->addFlash('error', 'Das angeforderte Hotel wurde nicht gefunden.'); return $this->redirectToRoute('app_booking_create_error'); } catch (HotelNotInTravelException $e) { $this->addFlash('error', 'Das Hotel ist für diese Reise nicht verfügbar.'); return $this->redirectToRoute('app_booking_create_error'); } catch (NoRoomsAvailableException $e) { $this->addFlash('error', 'Für diese Reise sind aktuell keine Zimmer verfügbar.'); return $this->redirectToRoute('app_booking_create_error'); } } /** * Safely retrieves booking DTO for HTMX requests with lightweight error responses. * * Returns empty 400 responses for HTMX requests when exceptions occur, * allowing the frontend to handle errors appropriately. */ protected function getOrCreateBookingCreateDtoForHtmx(BookingSessionService $bookingSessionService, Request $request): mixed { try { return $bookingSessionService->getOrCreateBookingCreateDto($request); } catch (BookingSessionNotFoundException|TravelNotFoundException|HotelNotFoundException|HotelNotInTravelException|NoRoomsAvailableException $e) { return new Response('', 400); } } }