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



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

def on_complete(env)
  case env[:status].to_i
  when 500
    raise "InternalServerError-#{error_message(env)}"
  when 502
    raise "BadGateway-#{error_message(env)}"
  when 503
    raise "ServiceUnavailable-#{error_message(env)}"
  end
end