Ejemplo n.º 1
0
def configure_error(response):
    """Return a custom exception based on the Configure response, None if no error."""
    return error_factory(
        response,
        response.status,
        status_to_string=auto_return_pb2.ConfigureResponse.Status.Name,
        status_to_error=_CONFIGURE_STATUS_TO_ERROR)
Ejemplo n.º 2
0
def _execute_choreography_errors(response):
    """Return an exception based on response from ExecuteChoreography RPC, None if no error."""
    return error_factory(response,
                         response.status,
                         status_to_string=choreography_sequence_pb2.
                         ExecuteChoreographyResponse.Status.Name,
                         status_to_error=_EXECUTE_CHOREOGRAPHY_STATUS_TO_ERROR)
def _directory_update_error(response):
    """Return an exception based on response from Update RPC, None if no error."""
    return error_factory(response,
                         response.status,
                         status_to_string=directory_registration_pb2.
                         UpdateServiceResponse.Status.Name,
                         status_to_error=_UPDATE_STATUS_TO_ERROR)
Ejemplo n.º 4
0
def _payload_registration_error(response):
    """Return a custom exception based on response, None if no error."""
    return error_factory(response,
                         response.status,
                         status_to_string=payload_registration_protos.
                         RegisterPayloadResponse.Status.Name,
                         status_to_error=_REGISTER_PAYLOAD_STATUS_TO_ERROR)
Ejemplo n.º 5
0
def _cal_status_error_from_response(response):
    """Return a custom exception based on response, None if no error."""
    return error_factory(response,
                         response.status,
                         status_to_string=spot_check_pb2.
                         CameraCalibrationFeedbackResponse.Status.Name,
                         status_to_error=_CAL_STATUS_TO_ERROR)
Ejemplo n.º 6
0
def _get_status_error(response):
    """Return a custom exception based on the GetStatus response, None if no error."""
    return error_factory(
        response,
        response.status,
        status_to_string=data_acquisition.GetStatusResponse.Status.Name,
        status_to_error=_GET_STATUS_STATUS_TO_ERROR)
Ejemplo n.º 7
0
def _cancel_acquisition_error(response):
    """Return a custom exception based on the CancelAcquisition response, None if no error."""
    return error_factory(response,
                         response.status,
                         status_to_string=data_acquisition.
                         CancelAcquisitionResponse.Status.Name,
                         status_to_error=_CANCEL_ACQUISITION_STATUS_TO_ERROR)
Ejemplo n.º 8
0
def _clear_service_fault_error(response):
    """Return an exception based on response from Clear RPC, None if no error."""
    return error_factory(response,
                         response.status,
                         status_to_string=service_fault_pb2.
                         ClearServiceFaultResponse.Status.Name,
                         status_to_error=_CLEAR_STATUS_TO_ERROR)
Ejemplo n.º 9
0
def acquire_data_error(response):
    """Return a custom exception based on the AcquireData response, None if no error."""
    return error_factory(
        response,
        response.status,
        status_to_string=data_acquisition.AcquireDataResponse.Status.Name,
        status_to_error=_ACQUIRE_DATA_STATUS_TO_ERROR)
Ejemplo n.º 10
0
def _trigger_service_fault_error(response):
    """Return an exception based on response from Trigger RPC, None if no error."""
    return error_factory(response,
                         response.status,
                         status_to_string=service_fault_pb2.
                         TriggerServiceFaultResponse.Status.Name,
                         status_to_error=_TRIGGER_STATUS_TO_ERROR)
Ejemplo n.º 11
0
def _create_edge_error(response):
    """Return a custom exception based on create edge response, None if no error."""
    return error_factory(
        response,
        response.status,
        status_to_string=recording_pb2.CreateEdgeResponse.Status.Name,
        status_to_error=_CREATE_EDGE_STATUS_TO_ERROR)
Ejemplo n.º 12
0
def _create_waypoint_error(response):
    """Return a custom exception based on create waypoint response, None if no error."""
    return error_factory(
        response,
        response.status,
        status_to_string=recording_pb2.CreateWaypointResponse.Status.Name,
        status_to_error=_CREATE_WAYPOINT_STATUS_TO_ERROR)
Ejemplo n.º 13
0
def _directory_unregister_error(response):
    """Return an exception based on response from Unregister RPC, None if no error."""
    return error_factory(response,
                         response.status,
                         status_to_string=directory_registration_pb2.
                         UnregisterServiceResponse.Status.Name,
                         status_to_error=_UNREGISTER_STATUS_TO_ERROR)
Ejemplo n.º 14
0
def _spot_check_error_from_response(response):
    """Return a custom exception based on response, None if no error."""
    return error_factory(
        response,
        response.error,
        status_to_string=spot_check_pb2.SpotCheckFeedbackResponse.Error.Name,
        status_to_error=_SC_ERROR_TO_ERROR)
Ejemplo n.º 15
0
def _docking_command_error_from_response(response):
    """Return an exception based on response from DockingCommand RPC, None if no error."""
    return error_factory(
        response,
        response.status,
        status_to_string=docking_pb2.DockingCommandResponse.Status.Name,
        status_to_error=_DOCKING_COMMAND_STATUS_TO_ERROR)
Ejemplo n.º 16
0
def _navigate_to_error(response):
    """Return a custom exception based on navigate to response, None if no error."""
    return error_factory(
        response,
        response.status,
        status_to_string=graph_nav_pb2.NavigateToResponse.Status.Name,
        status_to_error=_NAVIGATE_TO_STATUS_TO_ERROR)
Ejemplo n.º 17
0
def _set_localization_error(response):
    """Return a custom exception based on set localization response, None if no error."""
    return error_factory(
        response,
        response.status,
        status_to_string=graph_nav_pb2.SetLocalizationResponse.Status.Name,
        status_to_error=_SET_LOCALIZATION_STATUS_TO_ERROR)
Ejemplo n.º 18
0
def _stop_recording_error(response):
    """Return a custom exception based on stop recording response, None if no error."""
    return error_factory(
        response,
        response.status,
        status_to_string=recording_pb2.StopRecordingResponse.Status.Name,
        status_to_error=_STOP_RECORDING_STATUS_TO_ERROR)
Ejemplo n.º 19
0
def _update_payload_version_error(response):
    """Return a custom exception based on response, None if no error."""
    return error_factory(
        response,
        response.status,
        status_to_string=payload_registration_protos.
        UpdatePayloadVersionResponse.Status.Name,
        status_to_error=_UPDATE_PAYLOAD_VERSION_STATUS_TO_ERROR)
Ejemplo n.º 20
0
def _get_payload_auth_token_error(response):
    """Return a custom exception based on response, None if no error."""
    return error_factory(
        response,
        response.status,
        status_to_string=payload_registration_protos.
        GetPayloadAuthTokenResponse.Status.Name,
        status_to_error=_GET_PAYLOAD_AUTH_TOKEN_STATUS_TO_ERROR)
Ejemplo n.º 21
0
def _error_from_response(response):
    """Return a custom exception based on the first invalid point_cloud response, None if no error."""
    for point_cloud_response in response.point_cloud_responses:

        result = error_factory(response, point_cloud_response.status,
                               status_to_string=point_cloud_protos.PointCloudResponse.Status.Name,
                               status_to_error=_STATUS_TO_ERROR)
        if result is not None:
            return result
    return None
Ejemplo n.º 22
0
def _error_from_response(response):
    """Return a custom exception based on the first invalid image response, None if no error."""
    for image_response in response.image_responses:
        result = error_factory(
            response,
            image_response.status,
            status_to_string=image_pb2.ImageResponse.Status.Name,
            status_to_error=_STATUS_TO_ERROR)
        if result is not None:
            return result
    return None
Ejemplo n.º 23
0
def _clear_behavior_fault_error(response):
    """Return a custom exception based on response, None if no error.

    Args:
        response: Response message to check.

    Returns:
        custom exception based on response, None if no error
    """
    return error_factory(response,
                         response.status,
                         status_to_string=robot_command_pb2.
                         ClearBehaviorFaultResponse.Status.Name,
                         status_to_error=_CLEAR_BEHAVIOR_FAULT_STATUS_TO_ERROR)
Ejemplo n.º 24
0
def _robot_command_error(response):
    """Return a custom exception based on response, None if no error.

    Args:
        response: Response message to get the status from.

    Returns:
        None if status_to_error[status] maps to (None, _).
        Otherwise, an instance of an error determined by status_to_error.
    """
    return error_factory(
        response,
        response.status,
        status_to_string=robot_command_pb2.RobotCommandResponse.Status.Name,
        status_to_error=_ROBOT_COMMAND_STATUS_TO_ERROR)
Ejemplo n.º 25
0
def _restart_mission_error_from_response(response):
    return error_factory(
        response,
        response.status,
        status_to_string=mission_pb2.RestartMissionResponse.Status.Name,
        status_to_error=_RESTART_MISSION_STATUS_TO_ERROR)
Ejemplo n.º 26
0
def _stop_mission_error_from_response(response):
    return error_factory(
        response,
        response.status,
        status_to_string=mission_pb2.StopMissionResponse.Status.Name,
        status_to_error=_STOP_MISSION_STATUS_TO_ERROR)
Ejemplo n.º 27
0
def _pause_mission_error_from_response(response):
    return error_factory(
        response,
        response.status,
        status_to_string=mission_pb2.PauseMissionResponse.Status.Name,
        status_to_error=_PAUSE_MISSION_STATUS_TO_ERROR)
Ejemplo n.º 28
0
def _load_mission_error_from_response(response):
    return error_factory(
        response,
        response.status,
        status_to_string=mission_pb2.LoadMissionResponse.Status.Name,
        status_to_error=_LOAD_MISSION_STATUS_TO_ERROR)
Ejemplo n.º 29
0
def _answer_question_error_from_response(response):
    return error_factory(
        response,
        response.status,
        status_to_string=mission_pb2.AnswerQuestionResponse.Status.Name,
        status_to_error=_ANSWER_QUESTION_STATUS_TO_ERROR)
Ejemplo n.º 30
0
def _start_recording_state_errors(response):
    """Return an exception based on response from StartRecordingState RPC, None if no error."""
    return error_factory(
        response, response.status,
        status_to_string=choreography_sequence_pb2.StartRecordingStateResponse.Status.Name,
        status_to_error=_START_RECORDING_STATE_STATUS_TO_ERROR)