lib/url_reader.rb in url_reader-0.2.1 vs lib/url_reader.rb in url_reader-0.2.2
- old
+ new
@@ -67,16 +67,13 @@
RestClient::RequestTimeout,
RestClient::ServerBrokeConnection,
Errno::ECONNREFUSED,
Errno::ECONNRESET => e
ne = ReadError.new(e, "Read #{hash[:url]} failed")
- if options[:ignore_not_found]
- options[:ignore_read_errors] ||= []
- options[:ignore_read_errors] << 'PageNotFound'
- end
- if ignore_errors = options[:ignore_read_errors]
- return nil if ignore_errors.map { |x| x.is_a?(Integer) ? x : ReadError.const_get(x) }.include?(ne.type)
- end
+ ignore_errors = options[:ignore_errors] || []
+ ignore_errors << 'PageNotFound' if options[:ignore_not_found]
+ ignore_errors << 'InternalServerError' if options[:ignore_server_error]
+ return nil if ignore_errors.map { |x| x.is_a?(Integer) ? x : ReadError.const_get(x) }.include?(ne.type)
raise ne
end
return nil unless response
return resolve_encoding(response) if response.headers[:content_type] !~ /^image\//
response.to_str