def finish_current_handler(self) -> bool: if self.current_handler_id is not None: err_msg = "Got error finishing handler for queue %s" % (self.event_queue.id,) try: finish_handler(self.current_handler_id, self.event_queue.id, self.event_queue.contents(), self.apply_markdown) except Exception: logging.exception(err_msg) finally: self.disconnect_handler() return True return False