Class: Response::RaiseHttp5xx

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

Instance Method Summary collapse

Instance Method Details

#on_complete(env) ⇒ Object



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

def on_complete(env)
  env[:response].on_complete do |response|
    case response[:status].to_i
    when 500
      raise JustGiving::InternalServerError, error_message(response)
    end
  end
end