Sha256: f49ed098c0bf61713b5004970ed365025761023e865879bbe18a407132ad2804

Contents?: true

Size: 548 Bytes

Versions: 50

Compression:

Stored size: 548 Bytes

Contents

require 'faraday'
require 'actv/error/bad_request'
require 'actv/error/enhance_your_calm'
require 'actv/error/forbidden'
require 'actv/error/not_acceptable'
require 'actv/error/not_found'
require 'actv/error/unauthorized'

module ACTV
  module Response
    class RaiseClientError < Faraday::Response::Middleware

      def on_complete(env)
        status_code = env[:status].to_i
        error_class = ACTV::Error::ClientError.errors[status_code]
        raise error_class.from_response_body(env[:body]) if error_class
      end

    end
  end
end

Version data entries

50 entries across 50 versions & 1 rubygems

Version Path
actv-2.10.9 lib/actv/response/raise_client_error.rb
actv-2.10.8 lib/actv/response/raise_client_error.rb
actv-2.10.7 lib/actv/response/raise_client_error.rb
actv-2.10.6 lib/actv/response/raise_client_error.rb
actv-2.10.5 lib/actv/response/raise_client_error.rb
actv-2.10.4 lib/actv/response/raise_client_error.rb
actv-2.10.3 lib/actv/response/raise_client_error.rb
actv-2.10.2 lib/actv/response/raise_client_error.rb
actv-2.10.1 lib/actv/response/raise_client_error.rb
actv-2.10.0 lib/actv/response/raise_client_error.rb
actv-2.9.2 lib/actv/response/raise_client_error.rb
actv-2.9.1 lib/actv/response/raise_client_error.rb
actv-2.9.0 lib/actv/response/raise_client_error.rb
actv-2.8.2 lib/actv/response/raise_client_error.rb
actv-2.8.1 lib/actv/response/raise_client_error.rb
actv-2.7.0 lib/actv/response/raise_client_error.rb
actv-2.6.0 lib/actv/response/raise_client_error.rb
actv-2.5.2 lib/actv/response/raise_client_error.rb
actv-2.5.1 lib/actv/response/raise_client_error.rb
actv-2.5.0 lib/actv/response/raise_client_error.rb