def on_failure(&block)
      on do |_, _, reason|
        block.call(reason) if reason
      end
    end
def on_failure(&block)
      on do |_, _, reason|
        block.call(reason) if reason
      end
    end
command.on_failure do |e|
   ...
 end