def send_error(self, error):
        """Convenience method for writing Error frames up the wire.

        :param error:
            TChannel Error. :py:class`tchannel.errors.TChannelError`.
        :returns:
            A future that resolves when the write finishes.
        """

        error_message = build_raw_error_message(error)
        write_future = self.writer.put(error_message)
        write_future.add_done_callback(
            lambda f: IOLoop.current().add_callback(
                self.tchannel.event_emitter.fire(
                    EventType.after_send_error,
                    error,
                )
            )
        )
        return write_future
Convenience method for writing Error frames up the wire.

        :param error:
            TChannel Error. :py:class`tchannel.errors.TChannelError`.
        :returns:
            A future that resolves when the write finishes.