Skip to content
Browse files

Fixed some issues in the exception raising.

  • Loading branch information...
1 parent 789aa38 commit e21a4f69c68d28148045e7c98ce1841d72994e1e @jnunemaker jnunemaker committed Apr 8, 2009
Showing with 4 additions and 3 deletions.
  1. +4 −3 lib/twitter/request.rb
View
7 lib/twitter/request.rb
@@ -51,13 +51,14 @@ def make_friendly(response)
def raise_errors(response)
case response.code.to_i
when 400
- raise RateLimitExceeded.new(parse(response)), "(#{response.code}): #{response.message} - #{data['error']}"
+ data = parse(response)
+ raise RateLimitExceeded.new(data), "(#{response.code}): #{response.message} - #{data['error'] if data}"
when 401
data = parse(response)
- raise Unauthorized.new(data), "(#{response.code}): #{response.message} - #{data['error']}"
+ raise Unauthorized.new(data), "(#{response.code}): #{response.message} - #{data['error'] if data}"
when 403
data = parse(response)
- raise General.new(data), "(#{response.code}): #{response.message} - #{data['error']}"
+ raise General.new(data), "(#{response.code}): #{response.message} - #{data['error'] if data}"
when 404
raise NotFound, "(#{response.code}): #{response.message}"
when 500

0 comments on commit e21a4f6

Please sign in to comment.
Something went wrong with that request. Please try again.