Class: Response::RaiseHttp5xx

Inherits:
Middleware
  • Object
show all
Defined in:
lib/faraday/response/raise_http_5xx.rb

Instance Method Summary collapse

Instance Method Details

#on_complete(env) ⇒ Object



7
8
9
10
11
12
13
14
15
16
# File 'lib/faraday/response/raise_http_5xx.rb', line 7

def on_complete(env)
  case env[:status].to_i
  when 500
    raise TumblrOAuth::InternalServerError.new(error_message(env, "Something is technically wrong."), env[:response_headers])
  when 502
    raise TumblrOAuth::BadGateway.new(error_message(env, "Tumblr is down or being upgraded."), env[:response_headers])
  when 503
    raise TumblrOAuth::ServiceUnavailable.new(error_message(env, "(__-){ Tumblr is over capacity."), env[:response_headers])
  end
end