Exception: Ferrum::BrowserError

Inherits:
Error
  • Object
show all
Defined in:
lib/ferrum/errors.rb,
sig/ferrum/errors.rbs

Overview

Raised when the browser returns an error response over CDP. Wraps the raw response so callers can inspect its code and data.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response) ⇒ BrowserError

Returns a new instance of BrowserError.

Parameters:

  • response (Hash[String, untyped])


240
241
242
243
# File 'lib/ferrum/errors.rb', line 240

def initialize(response)
  @response = response
  super(response["message"])
end

Instance Attribute Details

#response ⇒ Hash[String, untyped] (readonly)

Returns the value of attribute response.

Returns:

  • (Hash[String, untyped])


238
239
240
# File 'lib/ferrum/errors.rb', line 238

def response
  @response
end

Instance Method Details

#code ⇒ Integer?

Error code from the raw CDP error response.

Returns:

  • (Integer, nil)


250
251
252
# File 'lib/ferrum/errors.rb', line 250

def code
  response["code"]
end

#data ⇒ Object?

Additional data from the raw CDP error response.

Returns:

  • (Object, nil)


259
260
261
# File 'lib/ferrum/errors.rb', line 259

def data
  response["data"]
end