Class: Relevance::Tarantula::InvalidHtmlHandler

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

Constant Summary

Constants included from Relevance::Tarantula

VERSION

Instance Method Summary collapse

Methods included from Relevance::Tarantula

#log, #rails_root, #tarantula_home, #verbose

Instance Method Details

#handle(result) ⇒ Object



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

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