Rescue from ‘execution expired’ in Ruby

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

Thankfully I found this snippet at

        # 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 :).

Leave a Reply