Exemplo n.º 1
0
    async def _send_command(self, command):
        resp = await self.protocol.send_and_receive(messages.command(command))
        inner = resp.inner()

        if inner.errorCode != 0:
            raise exceptions.CommandError(
                "Command {0} failed: {1}, {2}".format(
                    command, inner.errorCode, inner.handlerReturnStatus))
Exemplo n.º 2
0
    async def _send_command(self, command, **kwargs):
        resp = await self.protocol.send_and_receive(messages.command(command, **kwargs))
        inner = resp.inner()

        if inner.sendError == protobuf.SendError.NoError:
            return

        raise exceptions.CommandError(
            f"{CommandInfo_pb2.Command.Name(command)} failed: "
            f"SendError={protobuf.SendError.Enum.Name(inner.sendError)}, "
            "HandlerReturnStatus="
            f"{protobuf.HandlerReturnStatus.Enum.Name(inner.handlerReturnStatus)}"
        )