mini_fb 0.1.6 → 0.1.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/mini_fb.rb +15 -7
  2. metadata +1 -1
data/lib/mini_fb.rb CHANGED
@@ -166,13 +166,21 @@ module MiniFB
166
166
  return response.body if custom_format
167
167
 
168
168
  fb_method = kwargs["method"]
169
- if fb_method == "users.getLoggedInUser" # Little hack because this response isn't valid JSON
170
- return response.body
171
- end
172
- data = JSON.parse( response.body )
173
- puts 'response=' + data.inspect if @@logging
174
- if data.include?( "error_msg" ) then
175
- raise FaceBookError.new( data["error_code"] || 1, data["error_msg"] )
169
+ body = response.body
170
+
171
+ begin
172
+ data = JSON.parse( body )
173
+ puts 'response=' + data.inspect if @@logging
174
+ if data.include?( "error_msg" ) then
175
+ raise FaceBookError.new( data["error_code"] || 1, data["error_msg"] )
176
+ end
177
+
178
+ rescue JSON::ParserError => ex
179
+ if fb_method == "users.getLoggedInUser" # Little hack because this response isn't valid JSON
180
+ return body
181
+ else
182
+ raise ex
183
+ end
176
184
  end
177
185
  return data
178
186
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mini_fb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Travis Reeder