Set an error on this request, which will prevent request execution.
        Should only be called from "pre" hook methods.  If called from a post hook, this
        operation will be ignored.

        :Parameters:
          code
            Integer error code
          msg
            String description of the error
          data
            Optional additional info about the error. Should be a primitive, or a list or
            dict of primitives to avoid serialization issues.

def set_error(self, code, msg, data=None):
        """
        Set an error on this request, which will prevent request execution.
        Should only be called from "pre" hook methods.  If called from a post hook, this
        operation will be ignored.

        :Parameters:
          code
            Integer error code
          msg
            String description of the error
          data
            Optional additional info about the error. Should be a primitive, or a list or
            dict of primitives to avoid serialization issues.
        """
        self.error = err_response(self.request["id"], code, msg, data)