Skip to content
This repository has been archived by the owner on Oct 20, 2020. It is now read-only.

Commit

Permalink
guard against nil response in error handler
Browse files Browse the repository at this point in the history
  • Loading branch information
mislav committed May 3, 2012
1 parent b2840d0 commit 8434e8b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion app.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ def photos_by_tag(tag)


Stats::record(:errors) Stats::record(:errors)


if err.respond_to?(:response) and (body = err.response.body).is_a? Hash if err.respond_to?(:response) and (body = err.response && err.response.body).is_a? Hash
msg = if body['meta'] msg = if body['meta']
"%s: %s" % [ body['meta']['error_type'], body['meta']['error_message'] ] "%s: %s" % [ body['meta']['error_type'], body['meta']['error_message'] ]
else else
Expand Down

0 comments on commit 8434e8b

Please sign in to comment.