Sha256: e771f45838d1e73516bd669505734fef0c5f9053e65d8438c3c87ab872d35ce5

Contents?: true

Size: 509 Bytes

Versions: 1

Compression:

Stored size: 509 Bytes

Contents

require 'faraday'
require 'openamplify/error'

module OpenAmplify
  module Response
    class RaiseServerError < Faraday::Response::Middleware

      def on_complete(env)
        status  = env[:status].to_i
        body    = env[:body]
        headers = env[:response_headers]

        case status
        when 503
          raise OpenAmplify::Error::ServiceUnavailable.new "503 No server is available to handle this request.", headers
        end
      end

    end # RaiseServerError

  end # Response

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
openamplify-0.3.0 lib/openamplify/response/raise_server_error.rb