lib/fb_graph/node.rb in fb_graph-1.6.8 vs lib/fb_graph/node.rb in fb_graph-1.6.9
- old
+ new
@@ -114,18 +114,14 @@
handle_restclient_error(e)
end
def handle_restclient_error(e)
_response_ = JSON.parse(e.http_body).with_indifferent_access
- if _response_[:error]
- case _response_[:error][:type]
- when /OAuth/
- raise Unauthorized.new(_response_[:error][:message])
- else
- raise BadRequest.new("#{_response_[:error][:type]} :: #{_response_[:error][:message]}")
- end
+ case _response_[:error][:type]
+ when /OAuth/
+ raise Unauthorized.new(e.message, e.http_body)
else
- raise Exception.new(e.http_code, e.message, e.http_body)
+ raise BadRequest.new(e.message, e.http_body)
end
rescue JSON::ParserError
raise Exception.new(e.http_code, e.message, e.http_body)
end
end
\ No newline at end of file