class Rootage::ExceptionHandler

‘ExceptionHandler` is a handler of exception for action item.

Public Class Methods

new(exceptions, block) click to toggle source
# File lib/rootage/core.rb, line 463
def initialize(exceptions, block)
  @exceptions = exceptions
  @block = block
end

Public Instance Methods

handle(context, e, *args) click to toggle source
# File lib/rootage/core.rb, line 477
def handle(context, e, *args)
  context.instance_exec(e, *args, &@block)
end
try_to_handle(context, e, *args) click to toggle source
# File lib/rootage/core.rb, line 468
def try_to_handle(context, e, *args)
  if @exceptions.any?{|ec| e.kind_of?(ec)}
    handle(context, e, *args)
    return true
  end

  return false
end