/ Ruby

Rescue from ‘execution expired’ in Ruby

Today I was trying to rescue from an 'execution expired' error when using another colleague's gem (which interfaces with an XML RPC API).

Thankfully I found this snippet at http://geoff.evason.name/2011/01/16/rescue-from-execution-expired-in-ruby/.

  # do something involving Net:HTTP
rescue => e
  # This will NOT catch 'execution expired' !!
  puts "Rescue : #{e}"
rescue Timeout::Error => te
  # This explicit rescue will work
  puts "Rescued from timeout : #{te}"

Hopefully this will save someone a bit of time :).

comments powered by Disqus
Rescue from ‘execution expired’ in Ruby
Share this