class Adrian::FailureHandler

Public Class Methods

new() click to toggle source
# File lib/adrian/failure_handler.rb, line 3
def initialize
  @rules = []
end

Public Instance Methods

add_rule(*exceptions, &block) click to toggle source
# File lib/adrian/failure_handler.rb, line 7
def add_rule(*exceptions, &block)
  exceptions.each do |exception_class|
    @rules << Rule.new(exception_class, block)
  end
end
handle(exception) click to toggle source
# File lib/adrian/failure_handler.rb, line 13
def handle(exception)
  if rule = @rules.find { |r| r.match(exception) }
    rule.block
  end
end