Exception: WebStruct::JavaScriptRequiredError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/webstruct/errors.rb

Overview

Exception raised when HTML appears to be a client-rendered shell (little or no server-rendered body text) so static parsing would be misleading. Match details are exposed via #signals; see Shell.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(signals = []) ⇒ void

Records which shell heuristics fired and freezes them on the exception.

Parameters:

  • signals (Array<Symbol>) (defaults to: [])

    reasons produced by Shell.signals_for



39
40
41
42
# File 'lib/webstruct/errors.rb', line 39

def initialize(signals = [])
  @signals = signals.freeze
  super("Page appears to require JavaScript to render meaningful content.")
end

Instance Attribute Details

#signalsArray<Symbol> (readonly)

Returns heuristic flags that contributed to rejecting the document.

Returns:

  • (Array<Symbol>)

    heuristic flags that contributed to rejecting the document



33
34
35
# File 'lib/webstruct/errors.rb', line 33

def signals
  @signals
end