module ActiveSupport::ActionableError

def self.actions(error) # :nodoc:

:nodoc:
def self.actions(error) # :nodoc:
  case error
  when ActionableError, -> it { Class === it && it < ActionableError }
    error._actions
  else
    {}
  end
end

def self.dispatch(error, name) # :nodoc:

:nodoc:
def self.dispatch(error, name) # :nodoc:
  actions(error).fetch(name).call
rescue KeyError
  raise NonActionable, "Cannot find action \"#{name}\""
end