When dealing with exceptional (AKA failing) APIs reset your hashes in the rescue block to prevent 500s in responses.

def reassignment
  h = {}
  begin
    h['party'] = "party"
    raise "styrig"
  rescue
    h = {}
  end
  h
end

def no_reassignment
  h = {}
  begin
    h['party'] = "party"
    raise "styrig"
  rescue
  end
  h
end

puts reassignment
#=> {}
puts no_reassignment
#=> {:party => "party"}

Leave a Reply

Screen Shot 2013-12-08 at 9.49.35 PM

I have helped a dozen companies build and optimize their engineering teams to deliver great products.

Let’s work together and I can align your business needs with your technology initiatives.