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.4.0 lib/actv/response/raise_client_error.rb
actv-2.3.0 lib/actv/response/raise_client_error.rb
actv-2.2.1 lib/actv/response/raise_client_error.rb
actv-2.2.0 lib/actv/response/raise_client_error.rb
actv-2.1.1 lib/actv/response/raise_client_error.rb
actv-2.1.0 lib/actv/response/raise_client_error.rb
actv-2.0.0 lib/actv/response/raise_client_error.rb
actv-1.4.3 lib/actv/response/raise_client_error.rb
actv-1.4.2 lib/actv/response/raise_client_error.rb
actv-1.4.1 lib/actv/response/raise_client_error.rb
actv-1.4.0 lib/actv/response/raise_client_error.rb
actv-1.3.11 lib/actv/response/raise_client_error.rb
actv-1.3.10 lib/actv/response/raise_client_error.rb
actv-1.3.9 lib/actv/response/raise_client_error.rb
actv-1.3.8 lib/actv/response/raise_client_error.rb
actv-1.3.7 lib/actv/response/raise_client_error.rb
actv-1.3.6 lib/actv/response/raise_client_error.rb
actv-1.3.5 lib/actv/response/raise_client_error.rb
actv-1.3.4 lib/actv/response/raise_client_error.rb
actv-1.3.3 lib/actv/response/raise_client_error.rb