Sha256: 6abc41bc930a59a43007602c51472259e7b1be316883b4c931b1751f91e63fae
Contents?: true
Size: 606 Bytes
Versions: 14
Compression:
Stored size: 606 Bytes
Contents
require 'faraday' module Saddle module Middleware module Response class RaiseError < Faraday::Middleware def call(env) result = @app.call(env) case result.status when 404 raise Faraday::Error::ResourceNotFound, response_values(result) when 400...600 raise Faraday::Error::ClientError, response_values(result) end result end def response_values(result) {:status => result.status, :headers => result.headers, :body => result.body} end end end end end
Version data entries
14 entries across 14 versions & 1 rubygems