Class: OMDBGateway::ResponsePatcher

Inherits:
Faraday::Response::Middleware
  • Object
show all
Defined in:
lib/omdbgateway/response_patcher.rb

Instance Method Summary collapse

Instance Method Details

#call(env) ⇒ Object



3
4
5
6
7
8
9
10
# File 'lib/omdbgateway/response_patcher.rb', line 3

def call(env)
  begin
    @app.call(env)
    ResponseWrapper.new(env[:body], env[:status])
  rescue Faraday::Error::ConnectionFailed => e
    ResponseWrapper.new(nil, 500, "Connection Failed: #{e}")
  end
end