Class: Relevance::Tarantula::InvalidHtmlHandler

Inherits:
Object
  • Object
show all
Includes:
Relevance::Tarantula
Defined in:
lib/relevance/tarantula/invalid_html_handler.rb

Instance Method Summary collapse

Methods included from Relevance::Tarantula

#log, #rails_root, #tarantula_home, #verbose

Instance Method Details

#handle(result) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/relevance/tarantula/invalid_html_handler.rb', line 3

def handle(result)
  response = result.response
  return unless response.html?
  begin
    body = HTML::Document.new(response.body, true)
  rescue Exception => e
    error_result = result.dup
    error_result.success = false
    error_result.description = "Bad HTML (Scanner)"
    error_result.data = e.message
    error_result
  else
    nil
  end
end