Just today I've found my fbgraph implementation has started returning a 400 Bad Request error which is causing an internal server error.
The controller looks like:
def fb
fbclient = FBGraph::Client.new(:client_id => 'ID', :secret_id => 'SECRET')
@fbname = fbclient.selection.user('129220333799040').feed.info!['data'][0].from.name
@fbmessage = fbclient.selection.user('129220333799040').feed.info!['data'][0].message
end
How can I check before calling @fbname in my view that I've received a 200 status?
Thanks.
Update: following Devin M's suggestion, I've switched the above action to
def fb
fbclient = FBGraph::Client.new(:client_id => 'ID', :secret_id => 'SECRET')
begin
@fbname = fbclient.selection.user('129220333799040').feed.info!['data'][0].from.name
@fbmessage = fbclient.selection.user('129220333799040').feed.info!['data'][0].message
rescue
@fbname = "Facebook Account"
@fbmessage = "Facebook's API is a nightmare"
end
end