diff --git a/lib/controllers/flight.py b/lib/controllers/flight.py index 245bf21..7aa7ad0 100644 --- a/lib/controllers/flight.py +++ b/lib/controllers/flight.py @@ -73,10 +73,10 @@ async def create_flight( else: return FlightCreated(flight_id=flight_repo.flight_id) finally: - if flight_repo: - logger.info( - f"Call to controllers.flight.create_flight completed for Flight {flight_repo.flight_id}" - ) + flight_id = getattr(flight_repo, 'flight_id', 'unknown') if flight_repo else 'unknown' + logger.info( + f"Call to controllers.flight.create_flight completed for Flight {flight_id}" + ) @staticmethod async def get_flight_by_id(