diff --git a/src/isar_exr/api/energy_robotics_api.py b/src/isar_exr/api/energy_robotics_api.py index 07d39d0..fd25f3d 100644 --- a/src/isar_exr/api/energy_robotics_api.py +++ b/src/isar_exr/api/energy_robotics_api.py @@ -776,12 +776,14 @@ def get_current_site_stage(self, site_id: str) -> str: response_dict: dict[str, Any] = self.client.query( dsl_gql(current_site_stage_query), params ) + + if response_dict["currentSiteStage"] is not None: + return response_dict["currentSiteStage"]["id"] except Exception as e: message: str = "Could not get current site stage" self.logger.error(message) raise RobotAPIException( error_description=message, ) - if response_dict["currentSiteStage"] is not None: - return response_dict["currentSiteStage"]["id"] + return None