Added a try block so that one guestrequest failing doesn't blow up the entire thing

This commit is contained in:
Jonas Linter
2025-09-30 14:29:37 +02:00
parent 7380fa4378
commit a343013eed

View File

@@ -672,6 +672,8 @@ def create_xml_from_db(list: list[Tuple[Reservation, Customer]]):
for reservation, customer in list:
_LOGGER.info(f"Creating XML for reservation {reservation.form_id} and customer {customer.given_name}")
try:
phone_numbers = [(customer.phone, PhoneTechType.MOBILE)] if customer.phone is not None else []
customer_data = CustomerData(
given_name=customer.given_name,
@@ -808,6 +810,9 @@ def create_xml_from_db(list: list[Tuple[Reservation, Customer]]):
reservations_list.append(hotel_reservation)
except Exception as e:
_LOGGER.error(f"Error creating XML for reservation {reservation.form_id} and customer {customer.given_name}: {e}")
retrieved_reservations = OtaResRetrieveRs.ReservationsList(
hotel_reservation=reservations_list
)