lib/async/http/relative_location.rb in async-http-0.49.1 vs lib/async/http/relative_location.rb in async-http-0.50.0

- old
+ new

@@ -24,10 +24,13 @@ require 'protocol/http/middleware' module Async module HTTP + class TooManyRedirects < StandardError + end + # A client wrapper which transparently handles both relative and absolute redirects to a given maximum number of hops. class RelativeLocation < ::Protocol::HTTP::Middleware DEFAULT_METHOD = GET def initialize(app, maximum_hops = 4) @@ -67,10 +70,10 @@ else return response end end - raise ArgumentError, "Redirected #{hops} times, exceeded maximum!" + raise TooManyRedirects, "Redirected #{hops} times, exceeded maximum!" end end end end