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

linux - Mailx and Gmail nss config dir -

c# - Is it possible to remove an existing registration from Autofac container builder? -

php - Mysql PK and FK char(36) vs int(10) -