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

Popular posts from this blog

mod rewrite - Doing external redirect. .htaccess NS flag not working. How to achieve similar results? -

mysql - How to insert just year and month into date field? -