Specify the error that we want to ignore instead of rescuing all errors.

This commit is contained in:
Guo Xiang Tan 2017-07-18 09:50:06 +09:00
parent d7d22554ca
commit 089a1bd3be
1 changed files with 6 additions and 1 deletions

View File

@ -10,7 +10,12 @@ class FinalDestination
attr_reader :cookie
def initialize(url, opts=nil)
@uri = URI(url) rescue nil
@uri =
begin
URI(url) if url
rescue URI::InvalidURIError
end
@opts = opts || {}
@opts[:max_redirects] ||= 5
@opts[:lookup_ip] ||= lambda do |host|