The file in which is used graph.batch is in lib folder and since I can't use things like redirect_to or something else in these files I decided to handle this error writing rescue block in ApplicationController:
rescue_from Koala::Facebook::APIError do |exception|
redirect_to root_url, :alert => exception.message
end
But then I though that maybe I should handle 502 error and in that case I only have to write 502.html file in public folder. Right?
Can someone help me with the right path to handle this error. Thanks in advance :)