Exception: Capybara::Poltergeist::JavascriptError

Inherits:
ClientError show all
Defined in:
lib/capybara/poltergeist/errors.rb

Instance Attribute Summary

Attributes inherited from ClientError

#response

Instance Method Summary collapse

Methods inherited from ClientError

#initialize

Constructor Details

This class inherits a constructor from Capybara::Poltergeist::ClientError

Instance Method Details

#javascript_errorsObject



47
48
49
# File 'lib/capybara/poltergeist/errors.rb', line 47

def javascript_errors
  response['args'].first.map { |data| JSErrorItem.new(data['message'], data['stack']) }
end

#messageObject



51
52
53
54
55
56
57
# File 'lib/capybara/poltergeist/errors.rb', line 51

def message
  "One or more errors were raised in the Javascript code on the page. " \
    "If you don't care about these errors, you can ignore them by " \
    "setting js_errors: false in your Poltergeist configuration (see " \
    "documentation for details)." \
    "\n\n#{javascript_errors.map(&:to_s).join("\n")}"
end