Sha256: ec8db7edc18915b75cbde6eca6adb648e0976cae124f64212f89fdc215ef3452

Contents?: true

Size: 437 Bytes

Versions: 4

Compression:

Stored size: 437 Bytes

Contents

require 'faraday/response/raise_error'

module Signaling
  module FaradayMiddleware
    class RaiseError < ::Faraday::Response::RaiseError
      def on_complete(env)
        case env[:status]
        when 422
          raise Signaling::Error::UnprocessableEntity, response_values(env)
        when 403
          raise Signaling::Error::Forbidden, response_values(env)
        else
          super
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
signaling-1.1.2 lib/signaling/faraday_middleware/raise_error.rb
signaling-1.1.1 lib/signaling/faraday_middleware/raise_error.rb
signaling-1.1.0 lib/signaling/faraday_middleware/raise_error.rb
signaling-1.0.0 lib/signaling/faraday_middleware/raise_error.rb