Sha256: 019d9c2ebc4743a0647baea4514556620c596d64ea7cbade8922d706c6f24a6a

Contents?: true

Size: 585 Bytes

Versions: 4

Compression:

Stored size: 585 Bytes

Contents

require 'faraday'

# @private
module Faraday
  # @private
  class Response::RaiseHttp5xx < Response::Middleware
    def on_complete(env)
      case env[:status].to_i
      when 500
        raise Disqussion::InternalServerError.new(error_message(env, "Something is technically wrong."), env[:response_headers])
      end
    end

    private

    def error_message(env, body=nil)
      "#{env[:method].to_s.upcase} #{env[:url].to_s}: #{[env[:status].to_s + ':', body].compact.join(' ')} Check http://status.disqus.com/ for updates on the status of the Disqus service."
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
disqussion-0.0.4 lib/faraday/response/raise_http_5xx.rb
disqussion-0.0.3 lib/faraday/response/raise_http_5xx.rb
disqussion-0.0.2 lib/faraday/response/raise_http_5xx.rb
disqussion-0.0.1 lib/faraday/response/raise_http_5xx.rb