Method: HTMLProofer::UrlValidator::External#handle_connection_failure

Defined in:
lib/html_proofer/url_validator/external.rb

#handle_connection_failure(href, metadata, response_code, status_message) ⇒ Object

[View source]

175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
# File 'lib/html_proofer/url_validator/external.rb', line 175

def handle_connection_failure(href, , response_code, status_message)
  msgs = [<<~MSG,
    External link #{href} failed with something very wrong.
    It's possible libcurl couldn't connect to the server, or perhaps the request timed out.
    Sometimes, making too many requests at once also breaks things.
  MSG
  ]

  msgs << "Either way, the return message from the server is: #{status_message}" unless blank?(status_message)

  msg = msgs.join("\n").chomp

  @cache.add_external(href, , 0, msg, false)
  return if @runner.options[:only_4xx]

  add_failure(, msg, response_code)
end