Assuming the message argument is a string, I have the following snippet:
users.each do |user|
posted = Facebook.post_to_facebook(message,user.token)
end
Then, post_to_facebook is a method like this:
def post_to_facebook
facebook_graph = Koala::Facebook::GraphAPI.new(token)
object_from_koala = facebook_graph.put_wall_post(message)
end
For some users, when calling the put_wall_post I get an exception of this type: Koala::Facebook::APIError. I just want to skip posting to that user’s wall, and go to the next user, but I fail to see how to do that managing the exception.
you could use rescue like this, and maybe handle your exceptions