michaeljbishop / mulligan

Elegant, Ruby-ish Restartable Exceptions for Ruby (like Lisp's "Restarts")
http://michaeljbishop.github.io/mulligan/
MIT License
8 stars 0 forks source link

uninitialized constant 'IgnoringRecovery' #14

Open camilo1729 opened 8 years ago

camilo1729 commented 8 years ago

Hello I wanted to try out your gem, so I used the example code in the README:


require 'mulligan'

def calling_method
  method_that_raises
  "SUCCESS"
rescue Exception
  puts "RESCUED"
  recover IgnoringRecovery
  puts "HANDLED"
end

def method_that_raises
  puts "RAISING"
  case recovery
  when IgnoringRecovery
    puts "IGNORING"
  else
    raise "You can ignore this"
  end
  puts "AFTER RAISE"
end

calling_method

But when executing it, I got:

ruby mulligan.rb

RAISING RESCUED mulligan.rb:8:in rescue in calling_method': uninitialized constant IgnoringRecovery (NameError) from mulligan.rb:4:incalling_method' from mulligan.rb:24:in `

'

I dont know what I'm doing wrong. I'm running ruby vesion: 2.1.7p400.

Thank you