class GooglePlus::Response::RaiseServerError

Public Instance Methods

on_complete(env) click to toggle source
# File lib/google_plus/response/raise_server_error.rb, line 10
def on_complete(env)
  case env[:status].to_i
  when 500
    raise GooglePlus::Error::InternalServerError.new(error_message(env, "Something is technically wrong."), env[:response_headers])
  when 502
    raise GooglePlus::Error::BadGateway.new(error_message(env, "GooglePlus is down or being upgraded."), env[:response_headers])
  when 503
    raise GooglePlus::Error::ServiceUnavailable.new(error_message(env, "(__-){ GooglePlus is over capacity."), env[:response_headers])
  end
end

Private Instance Methods

error_message(env, body=nil) click to toggle source
# File lib/google_plus/response/raise_server_error.rb, line 23
def error_message(env, body=nil)
  "#{env[:method].to_s.upcase} #{env[:url].to_s}: #{[env[:status].to_s + ':', body].compact.join(' ')} Check http://status.google_plus.com/ for updates on the status of the GooglePlus service."
end