Which is the shortest way to silently ignore a Ruby exception -
i'm looking this:
raise exception rescue nil
but shortest way i've found this:
begin raise exception rescue exception end
def ignore_exception begin yield rescue exception end end
now write code
ignore_exception { puts "ignoring exception"; raise exception; puts "this ignored" }
Comments
Post a Comment