Sha256: ce8195348f7da38adcd1aed010cc328ffa9f7c2fe38dd323197fc13f74779420
Contents?: true
Size: 584 Bytes
Versions: 7
Compression:
Stored size: 584 Bytes
Contents
require "redd/error" module Redd module Response # Raises the appropriate error when one comes up. class RaiseError < Faraday::Middleware # Call the middleware. # @param faraday def call(faraday) @app.call(faraday).on_complete do |env| if error = Redd::Error.from_response(env) if error == Redd::Error::RateLimited time = env.body[:json][:ratelimit] fail error.new(env, time) else fail error.new(env) end end end end end end end
Version data entries
7 entries across 7 versions & 1 rubygems