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 (‘=> …, “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.
22 23 24 25 26 27 28 29 30 |
# File 'lib/capybara/lightpanda/errors.rb', line 22 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.
20 21 22 |
# File 'lib/capybara/lightpanda/errors.rb', line 20 def response @response end |
Instance Method Details
#code ⇒ Object
32 33 34 |
# File 'lib/capybara/lightpanda/errors.rb', line 32 def code @response&.dig("code") end |
#data ⇒ Object
36 37 38 |
# File 'lib/capybara/lightpanda/errors.rb', line 36 def data @response&.dig("data") end |