Exception: Capybara::Lightpanda::BrowserError
- Defined in:
- lib/capybara/lightpanda/errors.rb
Overview
Base class for any error originating from a CDP response or live browser
state. Lets callers rescue BrowserError to catch the whole CDP family
in one go (mirrors ferrum's hierarchy). Accepts either a CDP error hash
({"message" => ..., "code" => ...}) or a plain string for callsites
that raise with a literal message.
Direct Known Subclasses
DeadBrowserError, JavaScriptError, MouseEventFailed, NoExecutionContextError, NodeNotFoundError, ObsoleteNode
Instance Attribute Summary collapse
-
#response ⇒ Object
readonly
Returns the value of attribute response.
Instance Method Summary collapse
- #code ⇒ Object
- #data ⇒ Object
-
#initialize(response_or_message = nil) ⇒ BrowserError
constructor
A new instance of BrowserError.
Constructor Details
#initialize(response_or_message = nil) ⇒ BrowserError
Returns a new instance of BrowserError.
30 31 32 33 34 35 36 37 38 |
# File 'lib/capybara/lightpanda/errors.rb', line 30 def initialize( = nil) if .is_a?(Hash) @response = super(["message"]) else @response = nil super end end |
Instance Attribute Details
#response ⇒ Object (readonly)
Returns the value of attribute response.
28 29 30 |
# File 'lib/capybara/lightpanda/errors.rb', line 28 def response @response end |
Instance Method Details
#code ⇒ Object
40 41 42 |
# File 'lib/capybara/lightpanda/errors.rb', line 40 def code @response&.dig("code") end |
#data ⇒ Object
44 45 46 |
# File 'lib/capybara/lightpanda/errors.rb', line 44 def data @response&.dig("data") end |