class Stargate

Attributes

result[RW]

Public Instance Methods

attack() click to toggle source
# File activesupport/test/rescuable_test.rb, line 53
def attack
  raise WraithAttack
end
crash() click to toggle source
# File activesupport/test/rescuable_test.rb, line 65
def crash
  raise "unhandled RuntimeError"
end
dispatch(method) click to toggle source
# File activesupport/test/rescuable_test.rb, line 45
def dispatch(method)
  send(method)
rescue Exception => e
  unless rescue_with_handler(e)
    @result = "unhandled"
  end
end
fall_back_to_cause() click to toggle source
# File activesupport/test/rescuable_test.rb, line 85
def fall_back_to_cause
  # This exception is the cause and has a handler.
  ronanize
rescue
  # This is the exception we'll handle that doesn't have a cause.
  raise "unhandled RuntimeError with a handleable cause"
end
looped_crash() click to toggle source
# File activesupport/test/rescuable_test.rb, line 69
def looped_crash
  ex1 = StandardError.new("error 1")
  ex2 = StandardError.new("error 2")
  begin
    begin
      raise ex1
    rescue
      # sets the cause on ex2 to be ex1
      raise ex2
    end
  rescue
    # sets the cause on ex1 to be ex2
    raise ex1
  end
end
nuke() click to toggle source
# File activesupport/test/rescuable_test.rb, line 57
def nuke
  raise NuclearExplosion
end
ronanize() click to toggle source
# File activesupport/test/rescuable_test.rb, line 61
def ronanize
  raise MadRonon.new("dex")
end
sos() click to toggle source
# File activesupport/test/rescuable_test.rb, line 103
def sos
  @result = "killed"
end
sos_first() click to toggle source
# File activesupport/test/rescuable_test.rb, line 107
def sos_first
  @result = "sos_first"
end
weird() click to toggle source
# File activesupport/test/rescuable_test.rb, line 93
def weird
  StandardError.new.tap do |exc|
    def exc.weird?
      true
    end

    raise exc
  end
end