Skip to content

Commit

Permalink
Report correct exception when unable to add waypoint
Browse files Browse the repository at this point in the history
  • Loading branch information
andchiind committed Feb 22, 2024
1 parent c51c9e2 commit efdd0cb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
6 changes: 5 additions & 1 deletion src/isar_exr/api/energy_robotics_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from typing import Any, Dict, Optional

from gql.dsl import DSLMutation, DSLQuery, DSLSchema, DSLVariableDefinitions, dsl_gql
from gql.transport.exceptions import TransportQueryError
from robot_interface.models.exceptions.robot_exceptions import (
RobotAPIException,
RobotCommunicationException,
Expand All @@ -19,7 +20,6 @@
from isar_exr.api.models.enums import AwakeStatus
from isar_exr.api.models.models import (
AddPointOfInterestInput,
BatteryStatusType,
Pose3DStampedInput,
UpsertPointOfInterestInput,
)
Expand Down Expand Up @@ -344,6 +344,10 @@ def create_waypoint_task_definition(
response_dict: dict[str, Any] = self.client.query(
dsl_gql(create_waypoint_task_definition_mutation), params
)
except TransportQueryError as e:
raise RobotInfeasibleMissionException(
f"Unable to add waypoint with task name {task_name} as it is not reachable: {e}"
)
except Exception:
message: str = "Could not create waypoint task definition"
self.logger.error(message)
Expand Down
3 changes: 1 addition & 2 deletions src/isar_exr/robotinterface.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
Transform,
align_maps,
)
from isar_exr.models.exceptions import NoMissionRunningException
from robot_interface.models.exceptions.robot_exceptions import (
RobotCommunicationException,
RobotInfeasibleStepException,
Expand Down Expand Up @@ -54,14 +55,12 @@
Point3DInput,
PointOfInterestActionPhotoInput,
PointOfInterestActionVideoInput,
PointOfInterestByCustomerTag,
PointOfInterestTypeEnum,
Pose3DInput,
Pose3DStampedInput,
QuaternionInput,
)
from isar_exr.config.settings import settings
from isar_exr.models.exceptions import NoMissionRunningException


class Robot(RobotInterface):
Expand Down

0 comments on commit efdd0cb

Please sign in to comment.